• Register
1 vote
31 views

Problem:

I am totally new in programming language. So I tried to write a program using:
 public static void main(String args[])

But it seems to give error :

public static void main(String args[])
    ^
IndentationError: unexpected indent

What should I do?

10 7 2
6,060 points

Please log in or register to answer this question.

1 Answer

1 vote

Answer:

 public static void main(String args[])

Is not used in python.

Python's equivalent of "public static void main(String[] args) is:

import sys

def main(args):
    print args

if __**__ == '__**__':
    main(sys.argv)

** here represents any file name or any class or whatenver you have done. If you still dont understand ask me anything you want to know. 

Happy coding.

11 6 4
34,950 points

Related questions

0 votes
1 answer 29 views
29 views
Hi, when i try to execute this code i always get the error message from above, and i really want to know why, already tried to put a “public class XXXX” before the code, but not work anyway. public static String invertirPalabras(String cadena) { cadena += " "; String ... + palabra; if (cadena.charAt(i) == ' ') { nuevaCadena += palabra; palabra = ""; } } return nuevaCadena.trim(); }
asked Aug 2, 2020 Daniel Aguilar
3 votes
1 answer 1.6K views
1.6K views
Problem: Hello Kodlogs, I am a novice Java programmer. I just wrote my very first program a few minutes earlier. Now I want to write a program that can add two different integer numbers for me. I guess I done my coding well but it says something wrong with my writing and throws back an error: &ldquo ... []args){ int x = 10; int y = 15; int sum = x+y; System.out.println("Sum is: " + sum); } }
asked Mar 23, 2020 Gavin 15.3k points
0 votes
1 answer 656 views
656 views
Problem : I am trying to learn Java, I am very newbie however I wanted to know what I do to get the "run" it. I am facing below error: Static Error: This class does not have a static void main method accepting String[]. Below is my code: public class MyCaneirinho { public static void mycontar ... { System.out.println(j + x + y); } else { System.out.println(j + x + y + z); } } } } // MyCarneirinho
asked Dec 10, 2019 alecxe 7.5k points
1 vote
1 answer 20 views
20 views
Problem: I Created a Loan.java and compile it with JDK 1.6 and Run Loan.class with JRE 1.5. C:\Program Files\Java\jre1.5.0_06\bin>java -version java version "1.5.0_06" The following thing gives an error message: C:\Program Files\Java ... Source)         at java.net.URLClassLoader.defineClass(Unknown Source)         at java.net.URLClassLoader.access$100(Unknown Source) what should i do next ..
asked Mar 27, 2020 LizzyM 6.1k points
1 vote
1 answer 19 views
19 views
Problem: I am a beginner in programming language and I hvae been doing some coding practice and learning some programing logics .So, can anyone explain me the return statement in a void method of python?
asked Apr 8, 2020 LizzyM 6.1k points
0 votes
1 answer 6 views
6 views
Problem: The program is supposed to take in two names, and if they are the same length it should check if they are the same word. If it's the same word it will print "The names are the same". If they are the same length but with different letters it will print "The names are different ... than '{1}'"% name1, name2) elif len(name1) < len(name2): print ("'{0}'is longer than '{1}'"% name2, name1)
asked Feb 16 Mashhoodch 9.6k points
1 vote
1 answer 36 views
36 views
Problem: I am trying to run a program like import os,sys from scipy import stats import numpy as np f=open('data2.txt', 'r').readlines() N=len(f)-1 for i in range(0,N): w=f[i].split() l1=w[1:8] l2=w[8:15] list1=[float(x) for x in ... ,list2) print result[1] However, it is frequently returning the same error: ValueError: could not convert string to float: id Do you have any idea about this error?
asked Mar 7, 2020 Gavin 15.3k points
1 vote
2 answers 105 views
105 views
Problem : The program supposed to take in two names, and if they are the same length it should check if they are the same word. But i am getting below error in python python typeerror: not all arguments converted during string formatting
asked Oct 21, 2019 peterlaw 6.9k points
0 votes
2 answers 636 views
636 views
Problem : I am unable to figure out what is wrong with my code. When I try to compile my code I get the below message: &ldquo;Program does not contain a static 'main' method suitable for an entry point&rdquo;
asked Jan 29, 2020 jwilliam 3.9k points