First Java is case-sensitive. If a capitalization error occurs, the program cannot run.
The Java variable name must begin with a letter and can be followed by any combination of alphanumeric characters. The length is basically unlimited. However, you cannot use Java reserved words.
Standard naming convention: A class name is a noun that begins with an uppercase letter. If the name consists of more than one single order, the first letter of each word should be capitalized (this method of using uppercase letters in the middle of a word is called camel nomenclature.) Should be written in CamelCase).
The source code must have the same name as the public class, using. java as the extension. For example:
public class Firstsample
{
...
}
The file name should be Firstsample.java
If the file has been correctly named, it will be compiled with a file containing the class bytecode. such as FIRSTSAMPLE.CALSS. When you run a compiled program, the Java Virtual machine starts execution from the main method in the specified class, and in the Java language Specification, the main method must be declared public.
Basic data types
Floating point Type
| Type |
Storage requirements |
Range of values |
| Float |
4 bytes |
Valid bit 6-7 bit |
| Double |
8 bytes |
Valid bit 15 bit |
A double indicates that the numeric precision of this type is twice times the float type. Most applications use a double type. The precision of the float type is difficult to meet the requirements. The float type is rarely suitable for use. A value of type float has a suffix f or f. A floating-point value without a suffix defaults to a double type, or you can add a suffix D or D after a floating-point value. All floating-point computations follow the IEEE754 specification. The following are three special floating-point values that represent overflow and error conditions.
Zheng Infinity
Negative infinity
NaN (not a number)
For example, a positive integer divided by 0 results in positive infinity. The square root of the calculated 0/0 or negative number is Nan. Corresponds to constants Double.positive_infinty, Double.negative_infinity, and Double.NaN.
Char type
The char type is originally used to represent a single character, and some Unicode characters can now be described with a char value. A value of type char can be represented as a hexadecimal value, ranging from \u0000 to \UFFFF. Try not to use the char type in your program.
Boolean type
An integer value and a Boolean value cannot be converted to each other.
Java Basic program design structure one