Java learning notes (entry) _ java program helloWorld, _ javahelloworld

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.