I HAVE STARTED WITH JAVA BUT COMPILER GIVES ERROER

Andrew Watson

Total Post:39

Points:273
Posted by  Andrew Watson
Javac 
 881  View(s)
Ratings:
Rate this:

As you can tell I am just starting out, but I have been told I will probably be good at it

public class HelloWorld {

    public static void main(string[] args) {

        system.out.println("Hello world") ;

    }

}

the compiler says

"HelloWorld.java:3: error: cannot find symbol

    public static void main(string[] args) {

                            ^

  symbol:   class string

  location: class HelloWorld

HelloWorld.java:5: error: package system does not exist

        system.out.println("Hello world") ;

              ^

2 errors"

will somebody please explain to me what is wrong

  1. Chris S

    Post:48

    Points:336
    Re: I have started with java but compiler gives erroer

    Capitalization is important in this context. The class is String and I believe you need System like

    public static void main(String[] args) {

      System.out.println("Hello world") ;

    }

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!