• Register
1 vote


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,050 points

1 Answer

1 vote


 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 __**__ == '__**__':

** 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,930 points

Related questions

0 votes
1 answer 13 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 Daniel Aguilar
3 votes
1 answer 830 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 Gavin 15.3k points
0 votes
1 answer 354 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 24 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 Gavin 15.3k points