Java section 4th basic elements of Java

Source: Internet
Author: User

2016-06-28

1 Blank separator space, tab, line feed

2 keywords cannot be used for variable names, class names, object names, method names, and so on.

access Control private protected public

class, method, and variable modifier abstract class extends final implements interface native new static strictfp synchronized transient VO Latile

Program Control break continue return does while if-else for instanceof switch case default

error handling Try catch throw throws

Packages related Import Package

base Type boolean byte char double float int long short null true false
(Null True false these three are actually not keywords, they are separate identity types)

variable reference super this void

reserved word goto const

3 identifiers
Identifiers are the names of classes, methods, and variables.
Naming rules:
Can contain numbers, letters, underscores, dollar sign $, but cannot begin with a number.
Case sensitive
Keyword is not used as an identifier

Helloword compliant
Goto does not match
Agoto compliant
123goto Non-compliant

4 Notes
Single line Comment //The content here is a comment
This is the second line of comments
This is the third line of comments

Comment Block /* .... */

Document comments

/** This document comment, can be wrapped
Document comments allow the information about the program to be embedded inside the program, and we can use the Javadoc tool
To extract this information and form a help document
*/

5 separators

() parentheses define the parameter table of the method. Condition and, in a circular statement, a condition definition. Defines the precedence of an expression.
{} curly braces initialize the array, defining the program block, class, method.
[] square brackets DECLARE array types
; A semicolon indicates the end of a statement
, a comma variable declaration is used to separate multiple variables int i;int j;int i,j;
. Points are used for packages and sub-packages or classes, objects, and variables or methods to separate System.out.println ("Hello world!");

In addition to the comments can appear in Chinese, the other places are English, all kinds of punctuation must also be in English state.

Resources

[1] Java Easy Start Classic tutorial "full version"

Java section 4th basic elements of Java

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.