Im having trouble with a simple hello world program lol! Im hoping someone can shed some light on this.
So the error im receiving is the following:
$
You forgot about []
in String[] argv
or ...
in String... argv
. This array is used to store arguments used in command creating JVM for your class like
java Hello argument0 argument1 argument2`
and so on.
Your main method signature is wrong String
instead of String []
use
public static void main(String[] argv)
or
public static void main(String... argv)
read here
Problem is that your method does not take String array as a argument. Use following signature instead:
public static void main(String[] argv)
or
public static void main(String argv[])
Other valid option is:
public static void main(String ... argv)
In Java Language Specification this is told as follows:
The method main must be declared public, static, and void. It must specify a formal parameter (§8.4.1) whose declared type is array of String.
You forgot to put the array syntax, You can even use varargs as per JAVA 1.5
public static void main(String... argv)
public static void main(String[] args)
public static void main(String... args)
public static void main(String args[])
Java programs start executing at the main method, which has the above method prototype
Main method has signature that accepts String[]
and you wrote String
which is wrong,
Make it
public static void main(String[] argv)
or varargs
public static void main(String... argv)