Conclusion 4.9

Source: Internet
Author: User
  • 1. Java virtual machine execution process:

Compile the source file *. java. However, the source file cannot be recognized by virtual machines. Therefore, you must use the javac command to compile the source file *. Java into *. Class. When a virtual machine is working, first load the class, read the content of the class to be executed, and read the content of other classes used in the class.

The bytecode verification is performed when the Java program is executed. If the verification fails, the verification is rejected by the operating system. To protect the security of the operating system.

Before the interpreter is executed for the operating system, the interpreter is used to interpret the *. Class content as the code that can be recognized by the current operating system. Different operating systems have different interpreters, while JDK has different JDK for different operating systems.

  • Ii. Java Data Types

(1) numeric type:

1. Integer:

(1) The byte type 1 byte value ranges from-128-127.

(2) Short short integer 2 bytes

(3) int integer 4 bytes

(4) Long Integer 8 bytes

2. Floating Point Type

(1) float Single-precision floating point 4 bytes

(2) double floating point type 8 bytes

(2) balanced type:

Char 2 character → stored in integer type

(3) Boolean

Boolean logical type 1 byte → Boolean cannot be assigned a value

  • Iii. Variables

Variables must be initialized before use; otherwise, the compilation is incorrect.

  • Iv. Constants

Constant: it is a memory space with a name, but the content in the space cannot be changed during running.

Benefits of defining constants: 1. Business names can be introduced for Constants

2. Once the constant is changed, you can "change all ".

  • 5. identifier naming rules:

1. A class name starts with an uppercase letter and uses the camper name method.

2. The variable name and method name start with lowercase letters and use the camper name method.

3. All constant names are capitalized.

  • Vi. Conversion principles

(1) automatic conversion:

1. Values of small types can be automatically assigned to large types. Values of small types are automatically converted to large types before values are assigned.

2. When performing operations on small and large types, the small type is automatically converted to large type before calculation.

(2) forced conversion:

If the type is large to small, the forced conversion method may cause loss of precision.

  • VII. Operator number

Operator number:

+,-, *,/, And % (Note: % modulus → can be understood as remainder. Usage: Example: 102% 10 = 2)

Logical operator number: &, | (& represents and, | represents or)

Relational operators: >,<, >=, <=, =, and ,! = (Note: = is a comparison, and = is a value assignment. The two values are not the same .)

Note: To compare whether strings are equal, you cannot use = to use equals ()

  • 8. I = I + 1 Understanding

I = I + 1 meaning: the value of I + 1 is assigned to I

 

 

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.