Parsing of the first Java program

Source: Internet
Author: User

In the previous blog, we wrote the first Java program and compiled it in the most primitive way, many articles or books do not introduce that kind of compilation, but I think it helps us to better understand, learn Java, is not negligible part of me, there are many people around me, After a period of learning Java, only know how to develop in the IDE, but do not know how to run out of the IDE, it must be said that this is also a sad.

To get to the point, let's take a look at the example "Hello World" in the previous blog, which is one example that almost all programming languages will write, very classic.

Let's take a look at some of the following:

/** * My first Java program */public class HelloWorld {/** * Program Entry Method */public static void main (string[] args) {      On the console output Hello world!   System.out.println ("Hello world!"); }}

1, the first three code comments, in the actual compilation process will be ignored, Java comments in two ways: block comments and line comments, as we see, in this code, 1-3, 6-8 lines are block comments, block comments in the form of:/*......*/, Content that is contained in the middle is the comment content. 10 Behavior Line comments, comments in the form of://..., the contents of the same line//after the content is commented.

2, Java source file is a. java suffix file, essentially a text file, compiled by the compiler to generate bytecode, the compiled file with. Class as the end of the file, Java is running the file ending with a. class file (or a packaged. jar file).

3, the 4th line of HelloWorld is the class name (first understand the concept of class name, followed by), the file name must be the same as the class name, that is, the file name is: Helloworld.java, the compiled file name is: Helloworld.class.

4, line 9th public static void Main (string[] args), main is the Java program's entry method, the Java program must contain the method, the program starts from the method execution. string[in parentheses] args is the formal parameter that is used to receive the command entered when the program is started.

5. The 11th row is entered on the console: Hello world!.

To this, the first Java program has been analyzed, in the above mentioned some concepts, we only need to understand, the following will be introduced, now do not need to tangle.

This article is from the "Jianggujin blog" blog, make sure to keep this source http://jianggujin.blog.51cto.com/6808292/1715337

Parsing of the first Java program

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.