Java learning notes (entry) _ basic java syntax, learning notes _ java

Source: Internet
Author: User

Java learning notes (entry) _ basic java syntax, learning notes _ java
Preface
After learning the first java program, you will come to the system to learn java. Starting with the basic syntax, you can also understand this syntax in English or Chinese, but everyone has their own characteristics and differences. Learning programming is also a learning process of programming languages. When we are learning English, we all say that if we want to learn English well, we must speak with each other. In this case, when learning programming, we must write with each other. Programming is nothing more than a process of writing code. First, you need to have a foundation in your mind. How can you write without a foundation? Just like a good article, it cannot be written without a good pen. Good writing relies not only on accumulation, but also on creation, and programming. Java is an object-oriented language. During code writing, classes and interfaces and the following attributes and methods are the most commonly used. In the process of learning, we need to constantly accumulate important classes and methods, so that writing programs will be convenient and quick. The following describes the basic java Syntax:

The learning focus is as follows::
• Grasp the identifier definition rules
• Understand Common Reserved Words and delimiters
• Master the use of various simple data types
• Understanding the use of operators and expressions
• Master the simple Input and Output Methods of Java programs

1. Java identifier
The name of a variable, method, or class. The defined rules are as follows:
• Only letters, numbers, underscores, and dollar characters are allowed.
• It can only start with letters, underscores, and dollar characters. That is, it cannot start with a number.
• It is case sensitive and has no length restrictions. But it is better not to be too long or useless.
• It should have specific significance. It is best to use a related word, such as an addition method, so it is best to write it as: add (inta, intb ).

2. Reserved Java words
These reserved words are often used in programming.

3. Java Separator
• Contains space, Parentheses, curly braces, and semicolons.
• Each statement ends with a semicolon regardless of one or more rows. Blocks are multiple statements contained in {}. blocks can be nested. The blank space is inserted in the middle of the element of the Code: it consists of one or more spaces, or one or more tabs and spaces to form multiple blank lines.

4. Java annotations
Annotations are used to provide a standard description of the written code, which is not only organized, but also understandable to others and will facilitate future development.
(1) single row ://... Used to annotate a line of code
(2) multiple lines:/* used to comment out multiple lines of code
...
*/
(3) Document comment: Use the javadoc tool to extract information from the source code and document comment and convert it to an HTML file.
/**
*...
*/
5. Java Data Type
The data type is the type before defining an attribute or method, for example, inta; int is a data type, representing an integer variable. The data types in java are classified as follows:
 

6. Java operators and expressions
1. Arithmetic Operators: plus + minus-multiplication * Division/remainder % addition + + subtraction -- inverse-
2. Value assignment operator: =
3. Relational operators: ><==! =
4. logical operators: true, false
5. Conditional operators :? :

7. Java Input and Output
System. in indicates the input stream; System. out indicates the output.

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.