Introduction to Java first season 2

Source: Internet
Author: User

1. Variables: In Java, we describe variables by three elements: variable type, variable name, and variable value

Note: The punctuation in Java is in English

2. Variable name = First Letter + remainder

Letters, + Letters

Underline, number

$, underline

$

Note: Variables cannot start with a number

Cannot start with a special character other than an underscore, $ character

cannot be a Java keyword, reserved word

Good siege master habits: When the variable name consists of multiple words, the first letter is lowercase, then the first letter of the word is capitalized, and the hump is named

When a variable is named, it should be known

Java variable names are not limited, but the Java language is case-sensitive

3. Data type integer type in Java (Byte,short,int, long)

Base data type numeric floating-point type (float,double)

Character type (char)

Boolean Type (Boolean)

Data type

Reference data type classes (Class)

Interface (interface)

Array

Note: The data itself is stored in the basic data type variable

The spatial address of the data stored in the reference data type variable

String is a common reference data type that is used to represent a string

Rules for the use of variables in 4.java

Variables to be declared before use

When a variable is used, it can be initialized at the same time as a variable, or it can be declared and then assigned

Variable can only assign one value at a time

The variables defined in the main method must be assigned first to output

Variable names are not recommended for use in Chinese and are garbled during later cross-platform operations

5. Automatic type conversion in Java

6. Forced type conversion in Java ()

7. Application of Constants in Java

8. How to use annotations in Java

Introduction to Java first season 2

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.