Java learning notes (entry) _ java program helloWorld, _ javahelloworld
After installing and configuring the Java jdk, write the first java program-hello World. To output "Hello World" on the console ". First, we use the original method, that is, using a text editor to write code. In any drive letter, take the root directory of drive D as an example. Create a txt text under this directory, name it HelloWorld, and change the suffix to java, that is, HelloWorld. java.
Then open the edit code, as shown below:
Copy codeThe Code is as follows:
Public class HelloWorld
{
Public static void main (String args [])
{
System. out. println ("Hello World ");
}
}
After editing, save it. Then open the console and run the DOS command to go to disk D. Enter the compilation command "javac" and compile the java source file HelloWorld by entering the "javac" jdk. java, and then generate. class file.
Finally, to output "HelloWorld", compile the. class file and enter "java HelloWorld" in the console ".
This completes the first java program, which is very simple. In fact, to facilitate learning, we 'd better create a special file under a disk to write java programs. For example, create a directory named "java" under drive D, then write the program in this directory. At the beginning, it is best to use text to write programs instead of integrating the development environment, such as eclipse, because this will train the ability to write code specifications.