Reputation: 17
I'm new to Java can someone please explain to me what's wrong with this method:
clas Hello {
public static void main (String[]arg) {
Document.write ("hello world") ;
}}
Upvotes: 0
Views: 157
Reputation: 199234
This is the compiler output:
Hello.java:1: 'class' or 'interface' expected
clas Hello {
^
1 error
That means, that you should either type class
or interface
( In your case it should be class )
Assuming you had an error while copy/pasting it here, the problem reported by the compiler is:
Hello.java:3: cannot find symbol
symbol : variable Document
location: class Hello
Document.write ("hello world") ;
^
1 error
That means, the compiler doesn't know anything about a class named: Document
that's what cannot find symbol means in this case.
Perhaps you want to write:
System.out.println("Hello world");
Complete running program:
public class Hello {
public static void main(String[] args) {
System.out.println("Hello world");
}
}
Upvotes: 14
Reputation: 91881
You probably meant this:
public class Hello {
public static void main(String[] args) {
System.out.println("hello world");
}
}
Upvotes: 5
Reputation: 798744
class
.Document
coming from?Upvotes: 3