[Java Learning notes] Hello world, those things.

Source: Internet
Author: User

After we have installed and configured Java, we have to do a great job, according to international practice, the first program must be Hello World, let's look at Hello World.

1.Hello World Run

Hello World Process:

    1. Write Java code to a file in the. java suffix to save.
    2. The. java file is compiled with the Javac Compile command (generates a. class file after compilation).
    3. Run the generated, class file from the Java command.

Flow chart:

F:\Demo.java File Contents:

 Public class demo{    publicstaticvoid  main (string[] args) {        System.out.println ("Hello world!" );    }}

Go to the command-line window and execute Javac and Java commands, such as:

As you can see, the result is: Hello world! is printed at the command line.

2.Hello world should pay attention to the issues and details
    1. The main function, the main function, is the entry of the program and is called by the virtual machine to guarantee the independent operation of a class. The main function can only have one. The format must be public static void main (string[] args) {//code }
    2. Class is the Java keyword used to define classes. It should be noted that if the class is decorated with the public keyword, the saved. Java file name must be the class name. java.

[Java Learning notes] Hello world, those things.

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.