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") ;
}}
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");
}
}
You probably meant this:
public class Hello {
public static void main(String[] args) {
System.out.println("hello world");
}
}
class
. Document
coming from?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.