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

Discussion in 'Java' started by Gianni Galore, Aug 21, 2011.

  1. 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
     
    Gianni Galore, Aug 21, 2011
    #1
    1. Advertising

  2. Gianni Galore

    markspace Guest

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

    On 8/21/2011 10:41 AM, Gianni Galore wrote:
    > 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");
    > }


    }
     
    markspace, Aug 21, 2011
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. aidy
    Replies:
    13
    Views:
    718
    Ross Bamford
    Nov 3, 2005
  2. Ollej Reemt
    Replies:
    7
    Views:
    571
    Jack Klein
    Apr 22, 2005
  3. Thomas Hawtin

    doubt in public static void main

    Thomas Hawtin, Aug 2, 2006, in forum: Java
    Replies:
    4
    Views:
    9,152
    Chris Uppal
    Aug 3, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,090
    Smokey Grindel
    Dec 2, 2006
  5. int main(void) Why void?

    , Apr 6, 2006, in forum: C Programming
    Replies:
    6
    Views:
    512
Loading...

Share This Page