Sophomore second weekly

. 1, EnumTest.java

S and t does not refer to an object, an output false;
S type is not the original data, outputting false;
u is converted from the original type of the enumeration type, s, and u reference the same object, the output true;
column all values output SMALL, mEDIUM, LARGE;
enumerated type, a constant value of a list of specific types;
may be converted to a string enumeration;
enumeration cycle for all values output;
2, inverted, and complement original code
inverse code: positive anti same code and the original code, negative except the inverted sign bit is inverted to the number you.
Complement: complement positive number and the same original code, complement is negative in the case where the sign bit held constant, the negative of the original code becomes 0 becomes 0, 1, that the resulting negative anti-code, which is then added to the result obtained is a negative complement.
Anti-yard free anti-code number of the original code itself.
Complement any number of complement is the original code itself.
Java number is calculated by complement.
3, the shield of the same name variables principles
most scopes with braces to define a global variable has global scope, with local scope or scopes statements inside the curly braces. In whose scope, who will play a role, in line with the principle of "my site I call the shots," the.
4, the data transfer type strongly

data type conversion occurs is inconsistent and numeric data type is the variable type of the assigned received, it needs to convert from one data type to another data type. Data type to be converted into an implicit (automatic type conversions) and explicit conversions (casts) two.
If the following two conditions are met, then the type of data is assigned to another type of variable, the type of conversion to be performed automatically (automatic type conversion).
Two types of data compatible with each
target type in the range of greater than the source data type (data type is converted into lower advanced type data)
when the two data types are not compatible, or in the range less than the target type of source type, it can not be converted automatically carried out, then we need to be cast.
In the cast, the floating-point type if the value is converted to an integer, a decimal point directly remove all behind; and if it is an integer of casts of floating type, the zero padding after the decimal point.
E.g.
int. 3 = A;
Double B = 5.0;
A = (int) B;
. 5, string concatenation operation

first with a + x + y, in fact, to separate outputs x and y, are not actually calculated;
second = x + y, is the output after the calculation of x + y;

Guess you like

Origin www.cnblogs.com/yeyueweiliang/p/11545030.html