After building and configuring the JDK environment, prepare to test for success.
So I copied and pasted a piece of code with Notepad.
Public class HelloWorld { /** * Output line string "Hello world!" @param args */ Public Static void Main (string[] args) { System.out.println ("Hello world!" ); }}
Save as Helloworld.java file.
Then, in the cmd command line, using Javac compile (input Javac Helloworld.java), this prompt error occurs:
Helloworld.java:1: Error: Class HelloWorld is public and should be declared in a file named Helloworld.java HelloWorld
At that time do not know what this error means, always thought that the program inside what is missing a statement. (then the brain emerges similar to a microcontroller program that needs to be declared again).
Because a year did not touch the Java, then learned a little fur also forget. It was later remembered as if the class name in Java would be consistent with the file name.
Then locate the Helloworld.java file, change the file name to Helloworld.java, and then compile and run.
There was an expectation:
Hello world!
Helloworld.java:1: Error: Class HelloWorld is public and should be declared in a file named Helloworld.java HelloWorld