Java Learning record-programming start

Source: Internet
Author: User

One, Java program example (HelloWorld as an example)

Package test;

public class helloworld{

public static void Main (string[] args)

{

System.out.println ("Hello World")

}

}

Note:

1. The file name must be the same as the public-decorated class name, with. java as the filename suffix. If the defined class is not public, the file name can be different from the class name

2. There can be multiple classes in a. java file, but there is only one class that is public-decorated.

3.java source code compilation, a class corresponding to generate a. class file

4. A Java application should contain a main method, which is the entry method for the application. You can define a class that is not necessarily public-decorated in any one of the classes.

Ii. Java data types

Third, Java data type conversion

1. Automatic type conversion: positive direction. Conversion of small types to large types is done automatically, also known as "implicit type conversion", which occurs automatically and generally does not need to be processed.

2. Coercion type conversion: Reverse direction. Coercion type conversions are also known as explicit type conversions, which can overflow or lose precision, and pay attention to the range of data.

Iv. Java Annotations

1.//A single comment, all characters ending to the bank are ignored by the compiler

2./**/multiple lines of comment, all characters between/**/are ignored by the compiler

3./***/document comments, Java-specific, all characters between/***/are ignored by the compiler. You can use Javadoc to extract the comments from the Java original program to form an HTML page (only written in the package, class, properties, methods, constructors, before the introduction of comments can be extracted).

The annotations in Java are the ones that are read to programmers and ignored by Javac (the Java compiler) when compiled. Program comments are an important part of the source code, for a specification of the source code, the note should at least account for more than 1/3 of the source.

Java Learning record-programming start

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.