Do not reprint or copy without the consent of the author!!
1.javathe white Paper
The Java Designer is used to explain the original design and the completion of the situation;
2.javaThe advantages
In Java 's white paper, java has:
1. Simplicity --java eliminates many of the less-used, incomprehensible, confusing features of C + + , which allows for simple programming without esoteric training.
The simple on the other hand is small:java now has a separate smaller class library java Mini-version for embedded devices.
2. Object-oriented (tbd)
3. Robustness - The most representative is the Java exception handling, the program has a problem can quickly find out where the problem is, Also ensure that the program does not exit but print information continues to run.
4. Multithreading --java the implementation of multithreading to the underlying operating system or line libraries to complete. By using multi-threading, we can perform specific behaviors separately with different threads.
3.jdkenvironment variable Configuration
System variables → new java_home variable.
Variable value fill in the JDK installation directory (I am E:\Java\jdk1.7.0)
System variables → find Path variable → edit
Enter%java_home%\bin at the end of the variable value ;
4.javathe BASIC program Structure4.1 javaNote:
Java is case-sensitive,
The class name must start with a letter and the first letter be capitalized
Multiple words make up the first letter of each word capitalized
4.2Data Type
The Java language is a strongly typed language, and a type must be declared for each variable, so the variable must be defined before it can be used;
There are 8 Basic Types in Java: (4 shaping,2 floating point)
Integer: Represents a number that has no fractional part, is allowed to be negative, and the long integer type is followed by L;
Byte Short int Long
Floating point: A numeric value that represents a fractional part.
float: suffix f 3.41F without F default to double type (rarely used)
Double: The value after the suffix D can be added by default;( common )
Char type: constant used to represent a character;
Boolean type: There are 2 values:false and true to determine the logical condition of the
4.3variables
Variable names are differentiated to lowercase,
After you declare a variable, you must assign a variable to use it.
Assigning a variable with a declared value requires that the variable name be placed to the left of (=) .
in Java development, the declaration of variables is as close to the first use as possible, which is a good writing style.
4.4Constants
In Java, the keyword final indicates a constant, indicating that the variable can only be assigned once. The habit is to have a constant named all uppercase.
In Java , you want constants to be used in more than one method of a class, which is typically a class constant.
4.5operator
+-*/ corresponds to subtraction 15%2 =1 to take the remainder or to take the mold
4.6Relational Operators
= = Indicates whether the values are equal
! = does not equal
&&: double and the expression and Judge both sides of the same true is true ( with short-circuit effect, when the first expression is not immediately after the condition does not execute ) .
| |: double or either one of the two is True ( with a short-circuit effect, when the first expression is not immediately followed by the condition is not performed ).
4.7Bitwise Operators
&: Single and judgment both sides are true ( regardless of whether the first expression is true or false, the program executes the second conditional expression )
| : One or both of the two are true ( Whether the first expression is true or false, The program will execute the second conditional expression. )
4.8detects whether strings are equal andStringof theAPI
String str = "Hello";
Str.equals ("Hello");// Case Sensitive
Str.equalsignorecase ("Hello");/ /Case insensitive
Str.tolowercase ();// converts a string into lowercase
Str.touppercase ();// converts a string into uppercase
Str.trim ();// Delete the string header and trailing spaces
4.9Building a String
Execution Speed: StringBuilder > StringBuffer > String
String is a character constant, and each time a connection is constructed a new string object is wasted space;
StringBuilder: Character variable thread unsafe for single-threaded operation
StringBuffer: Character variable thread safe for multithreaded operations
5.0Blocks (Block) Scope
A variable with the same name cannot be declared in a nested two block.
5.1Array
Array declaration: int [] A;
Creates a numeric array, so the element defaults to 0, the object array defaults to null, andtheboolean defaults to false .
Kowloon _java Development Road _1