Why does Eclipse find error in simple "public static void main( String[] args) { } instruction?

G

Gianni Galore

Am I crazy? I setup just the most simple java program in a new v3.6.2 Eclipse java project:


package aaa.bbb;

public static void main( String[] args) {
System.out.println("hello");
}


And Eclipse thinks the line

public static void main( String[] args) {

contains already an error (indicating a white x on red dot). When hovering above the red ot the Eclipse tells me:

- Syntax error, insert ")" to complete SimpleMemberAbnnotation
- Syntax error on toker "]", invalid(
- ...

Hmm, whats wrong? Eclipse does not like the brackets after "String[]"

I guess its a wrong Eclipse setting for the Java project but which?

I use J2SE v1.6upd26 under Win7

Gianni
 
M

markspace

Am I crazy?


Possibly. I'd suggest consulting a mental health professional if you're
concerned about it. ;) (j/k)

Also, most Java programmers know that methods can't be bare, they need
to be enclosed in a class definitions. Two seconds with the Java
tutorial would have reminded you.
package aaa.bbb;

public class Main {
public static void main( String[] args) {
System.out.println("hello");
}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top