Java Review Consolidation

Source: Internet
Author: User

Watch the video review Java for some time. Although the things I do now are net, I haven't forgotten to review Java.

More probably here.

Naming rules for Java variables:

(A) Composition rules:

1: English uppercase and lowercase letters
2: Number
3:$ and _
(2) precautions:
A: Cannot start with a number
B: cannot be a keyword in Java
C: Case Sensitive
(3) Common naming conventions (see Name and meaning)
A: Package All lowercase
Single-level package: lowercase
Example: jiemo,com
Multi-level package: lowercase, and separated by.
Example: Cn.jiemoxiaodi,com.baidu
B: Class or interface
One word: Capitalize the first letter
Example: Student,demo
Multiple words: Capitalize the first letter of each word
Example: Helloworld,studentname
C: Method or Variable
One word: First letter lowercase
Example: Name,main
Multiple words: Start with the second word, capitalize the first letter of each word
Example: Studentage,showallnames ()
D: Constant
All caps
One word: Uppercase
Example: PI
Multiple words: Uppercase and separated by _
Example: Student_max_age

Comments in Java:

1, single-line//

2, multi-line/**/

I start with the basic data type:
note:
integers by default are of type int, and floating-point numbers are double by default.
long integers to be added L or L.
Single-precision floating-point numbers are added F or f.

number According to type
byte short 2
int 4
8
4
double char 2
boolean 1

Data type Conversions
(1) Boolean type does not participate in conversions
(2) Default conversion
A: From small to large
B:byte,short,char--INT--long--float--double
C:byte,short,char do not convert each other, directly into the int type participates in the operation.
(3) Forced conversion
A: from big to small
B: There may be a loss of precision, generally not recommended for such use.
C: Format:
Target data type variable name = (target data type) (converted data);

Java Review Consolidation

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.