I'm new to java can someone please explain to me whats wrong with this method:
clas Hello {
public static void main (String[]arg) {
Document.write ("hello world") ;
}}
I'm new to java can someone please explain to me whats wrong with this method:
clas Hello {
public static void main (String[]arg) {
Document.write ("hello world") ;
}}
class
.Document
coming from?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");
}
}