In fact, there is no other reason, want to learn to learn Android, think about, or first good Java to learn the basics, so the latter will be convenient, starting from the Java Foundation a little summary of learning:
A: The basic data type:
In accordance with some of the points of attention in their study summary:
1. Type of shaping
(1): Cannot start with 0 as the beginning of the decimal (except 0)
(2): octal must start with 0 such as: 02313 conversion decimal 0*8^4+2*8^3+3*8^2+1*8^1+3*8^0
(3): Hex to start at 0x or 0X such as: 0x453 conversion decimal 4*16^2+5*16^1+3*16^0
(4): Below is the size of the memory space they occupy
2. Floating-point types
In the default case, decimals are treated as double types, if using a float type of decimal. You need to add F or F after the decimal, you can use the suffix D or D to indicate that this is a double type of data, no "D" is not an error, but if you declare a float variable without "f", the system will be considered a double type and an error occurs.
3. Boolean type
Boolean type to define a Boolean type of variable, only true and false two values, respectively, represent true and false, he can not and shaping the type of conversion, which Swift and it is the same.
Two: Variables and constants
First of all, the declaration of variables, Java variables is also very simple, like we c declaration variable int A; Of course you can also assign values to variable declarations, such as int b = 2;
Besides, constants, Jave constants are also called final variables, declaring a constant in addition to the data type of the constant, but also by the final keyword to qualify, the constant name is generally uppercase letters, easy to distinguish; final Boolean BOOL = true; A constant called BOOL is declared. As far as the valid range of this variable is, local variables and global variables should be understood.
Three: operator
After reading this part of the basic content, operators here and the C language is similar, some places need my own attention, listing:
(1): In logical operators here, "&&" and "&" both represent the logic and what is the difference between them? First talk about the front of the "&&", this is to determine the first expression of the true and false, if the front is false, it is not in the execution of the expression behind the judgment, the direct judgment of the whole is false, but "&" is not so, in time the front is false or will execute the following expression statements, In order to determine the true and false of the entire expression, so there is an image of the name, the front of the amount called "short-circuit operator", followed by the "non-short-circuit" operator.
(2): about the precedence of the entire operator, so that a sentence summed up to everyone: arithmetic displacement ratio, the logical conditions of the assignment tease!
Summary of the Java language basics