My first Java program, the first Java program

Source: Internet
Author: User

My first Java program, the first Java program

My first Java program:

Class Test
{
Public static void main (String [] args)
{
System. out. println ("this is my first java program ");
}
}

Note: The first letter of the class name must be capitalized.

 

Procedure:

1. Create a Java source program in Notepad (or UE)

Or

 

Note: The file extension is. java. Strict attention should be given to spaces and upper and lower cases. The colon and semicolon must be entered in English.

2. Compile:

3. Execute:

Note: The name of the Java program I created overlaps with the class name. The Java Test command is used during execution. Here, Test refers to the Test (class Name) after the class in the text ).

 

Here are some notes:

1. Multiple classes can be written in a source file;

2. If the class declares the public type, the class name must be the same as the source file name;

3. Only one class declared by public can be found in the same source file.

 

Three annotations are described here:

1. // The comment here

 

2 ./*

Note

*/

 

3 ./**

* Comment

* Comment

* Comment

* Comment

*/

Related Article

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.