Java Learning notes (Getting started) _java program Helloworld_java

Source: Internet
Author: User

After installing the Java JDK, start writing the first Java program--hello World. Used to output "Hello World" to the console. First, we use the original method of writing code with a text editor. In any one of the letter, take D packing directory as an example, in this directory to create a txt text, named HelloWorld, and then change the suffix to Java, that is, Helloworld.java.

Then open the edit code as follows:

Copy Code code as follows:

public class HelloWorld
{
public static void Main (String args[])
{
System.out.println ("Hello World");
}
}

After editing, save, then open the console with a DOS command to enter the D disk, enter the compile command "Javac", start compiling the Java source file Helloworld.java by entering the "Javac" JDK, and then generate the. class file.

Finally, to output "HelloWorld", to compile this. class file, enter "Java HelloWorld" in the console. As shown in figure:

This completes the first Java program, very simple. In fact, in order to facilitate learning, we'd better set up a special file under a disk to write Java programs, such as in the D disk to create a directory called "Java", and then write the program in this directory. It's best to start with text instead of an integrated development environment, such as Eclipse and so on, because it will exercise 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.