Getting Started with java
java is compiled and interpreted mixing mechanism. First compiled into byte code, and then interpreted by a jvm a virtual machine to perform a binary
The basic syntax of java
Case sensitive : Java is case-sensitive, which means that the identifier Hello and hello are different.
Class Name : For all classes, the class name first letter should be capitalized. If the class name composed of several words, the first letter of each word should be capitalized, such as MyFirstJavaClass.
Method name : All method name should begin with a lowercase letter. If the method name contains several words, each word is capitalized later.
Source File name : source file name must be the same as the class name. When saving files, you should use the class name as the file name to save (Remember that Java is case-sensitive), the file name extension is .java. (If the file name and class name are not the same will result in a compilation error).
Method main entrance : all the Java programs public static void main (String [] args) method to begin.
java identifier
All components of the Java name is required. Class names, method names and variable names are called tags.
About Java identifiers, the following points should be noted:
All identifiers should be a letter (AZ or az), dollar sign (
any combination of underscore (_) or number of
keyword identifiers can not be used as
identifiers are case sensitive
Keyword
java all keywords:
java data types
java data types can be divided into two categories:
basic data types: byte, short, int, long , double, float, boolean, char
reference data types: class, interface, array, enumeration, annotations
Basic data type conversion
variable
Variable definitions: [Modifier] [access specifier data type variable name] [] = initial value;
Example:private ststic int x = 20 ;
constant
Constant definitions: access specifier [] [] Modifier final data type variable name = initial value;
Example: static final double PI =3.1415926;
Constant declaration must be initialized, and can not be reassigned.
Constant variable difference
Bitwise Operators
"Bitwise and" "&"
"bitwise or" "|"
"bitwise" "~"
"bitwise exclusive or" "^"
Logical Operators
AND "&&"
logical or "||"
logical NOT "!"
When no short-circuit logical operators, i.e., the foregoing expression can be obtained a final result, the expression that will not be executed.