Squiring SCJP's listening notes Toss original???
SCJP's note on the first day of preface: ?? Java's charm one, 1, powerful granting ability: the existence of virtual machines, different platforms have different virtual machines. 2, object-oriented; 3, good security: virtual machine security settings, security of application servers. 4, networked capacity.
Second, the middleware technology: EJB is well solved with the problem of database connection.
Third, design mode MVC
M ?????????????????????????????????????? view ?? ??????????????????????????????????? servlet taglib ?????????? Applet ???????????? Control page flows EJB business logic
IE --------------> WebServer --------------> Appliation Server --------> DB ?????? ??????????? jsp ?? applet ??????????? ejb ????????? javabean ????????????? ?? WebSerice ????????? servlet
EJB cannot be deployed on the Internet, and the RI protocol cannot pass the firewall. The stateless session bean can be released as WebSerice.
Fourth, configure Java's environment: After the JDK1.4 is installed, add ClassPath to the environment variable to modify the PATH. 1, classpath.; C: /j2sdk1.4/lib/tools.jar "." Indicates that the path to the virtual machine find class is from the current path. 2.Pathc: /j2sdk1.4/bin
EditPlus increases the tools to compile and run Java. Compiling Java Tool Settings Commands C: /J2SDK1.4/bin/javac.exe Parameters $ (filename) Initial Directory $ (FileDir) Tool Settings Command C: /J2SDK1.4/bin/javac.exe Parameters $ FILENAME) WILENAME? Initial Directory $ (Filedir)
Chapter One
First, JVM1, the Java store file name must be a buckler name with a public class name (including the master method) 2, the java program ends with .java. Java is case sensitive, general code customs. The first character of the class name, method, and variables of the first character lowercase, constant is all uppercase.
2. The variable in the garbage collection mechanism Garbage Collection memory is automatically discarded when it is referenced by any program.
Supplementary instance? ?
Third, source file layout
Package abc.def ??? ("." means the subdirectory path, the relative path of the current directory as the starting point) PUBLIC CLASS A {} Class B {} Class C} Class B {} Class C}
Package: One form of organizational directory
|| ---- # ABC ???? | ???? | # def ???? | ???? | ---- a.class ???? | ---- b.class? ??? | ---- c.class
Package / Make mechanism Javac -d. File name? Description only needs to be compiled, the output path of the class file is generated in the current directory.
The class file is placed in the package path and runs under the previous directory of the package when running the program.
Packing method: JAR CVF abc.jar ABC (Description: abc.jar is the target file, ABC source file) package is also packaged in the previous directory of the package.
After packaging it, you can test .jar in the ClassPath environment variable.
(Supplementary instance)
Chapter 2? Identifier Keyword Type
1, the number cannot be the first character of the identifier.
2, Note in Java: int X; // a comment ???????????????????????????? Integer: * / int x; ??????????????????????????? "/ *" and "* /" all content Content, the compiler does not work on this comment? / ** x - an integer representing the x coordinate * / int x; ?????????? "/ **" and "* /" All the contents of the comment are notes, the compiler does not process this comment. This comment is used when the document tool Javadoc generates documents. 3, with a total of 52, where goto, const is no practical.
4, TYPE type Basic types 8: Boolean, Char, Byte, Short, long, int, float, Double and C / C languages are different, in the Java language, all basic data types have preset values. That is to say, when we declare a variable, even if we don't assign it, its value is also certain, not as unpredictable as in C / C . The specific type of preset is shown in the table below:
Basic data type preset value Boolean false char '/ u000' Byte (byte) 0 Short (Short) 0 INT 0 long 0l float 0.0l double 0.0d
In the Java language, all constants have three forms, which are: decimal, octal, and hexadecimal. It should be noted that the decimal number cannot be started at 0, because the number of octal is starting with 0, while the number of hexadecimal starts at 0x or 0x.
The floating point is the default is the Double ??? Integer for INT
Character constant character type constants is a single character with a character caused by two single quotes. However, the two single quotes can't be single quotes and backslashes, ie '' 'and' / 'are incorrect ways.
Everyone must remember that the characters in the Java language are 16-bit Unicode characters, which is different from language such as C / C .
Like the C / C language, Java languages also have a translivation sequence. The function of the translitement sequence in Java is shown in the following table:
Side sequence standard form function description? / ?? Continue? / N? Nl? Enter the Ranking Rank? / T? Ht? Horizontal tab? / B? BS? Return? / R? Cr? Enter the train ? / f? ff? Change page? / '?'? Single number? //? /? backslash? / "?"? Double quotes? / ddd? 0ddd? octal mode? / xddd? 0xDDD? 16 Mode? / Udddd? 0xddddd? Unicode double-byte character
String constant string constant is a series of characters caused by double quotes. Different from the C / C language, the string in the Java language is not implemented by the character array, but through the string class (ie String Class) is implemented.
Data Type Conversion Problem: (1) Small Range - "Large Range? Automatic Conversion (2) Various Range -" Small Range? Mandatory Conversion (3) In the same case, low accuracy is promoted to high precision (Since the principle of four, the principle) ?? float f = 3.14f ?? INT i = (int) 3.14 (4) short, Byte is automatically promoted to int, and then calculates.
Public class? javatest1 {??? public static void main (string [] args) ??? {??????? SHORT A, B, C; ??????? a = 1; ??? ???? b = 2; ??????? // c = a b ;? // A B result is INT, and cannot determine whether it exceeds C. ??????? c = (short) (a b); ??? ?????????????? system.out.println (c); ???}}?
Reference type
Array object
Create an object: (1) Define a class; (2) declare an object; (3) Create an object;
The role of the new key: (1) Assign memory space for this object; (2) Returns a reference to the memory space, returns the first address; (reference is the alias of the pointer) (3) call constructor, the constructor is automatically Function assignment.
The class instance is equivalent to the object, which is a piecewise saved in the memory storage area.
Output Type System.out.Println (); From Moving Tostring () Public String Tostring () PUBLIC STRING TOSTRING
5. When the value transfer (test point) is called, the principle of passing principles: the basic type data of the basic type data, passes the argument of the copy reference type of the argument, passed the copy of the reference first address
Chapter 3? Variable Operator Process Control 1, Variables and Scope
(1) Member variables, also known as attributes, domains; can be used throughout the class, and the member variable automatically assigns initial value;
(2) Method variable. Also known as auto variables, local variables; in this method. The initial value is assigned when the method variable is executed, and the first value must be assigned before use.
2, short circuit operators &&, || have short-circuit role
A && B When A is False, do not perform B, short circuits; A || B When A is True, do not execute B, short circuits occur.
3, shift operator << left shims, vacancy, left shift value = 2 ^ n * original value (N mobile bits, no overflow, lost "0") >> right shift, vacancy 0 or 1, if the original number is 1, then supplement 1; if the original number is the highest is 0, then supplement 0; >>> right shift, the vacancy is all settled.
4, process control switch () {case constant 1: statement 1; Break; case constant 2: statement 2; Break; default: statement;
If not, the program will continue to execute and perform the next case.
The label only allows you to appear in front of the loop code.
Chapter 5? Array 1, declaration array, cannot indicate the size of the array. INT [] i; INT i []; 2, create array array members automation (equivalent to class member variable) int [] i = new int [3] 3, assignment i [0] = 1; int [] i = {1, 2, 3} int [] i, j; i = new int [3]; j = i; int [] i = new int [] {1, 2, 3}
2-dimensional array declaration, create int i [] [] = new int = [2] [3] int [] i [] = new int [2] [] (must point out the size of the first dimension) int [] [] I = New int [2] [3] The number of dimensions of arrays is different, and it cannot be assigned by switching applications. INT [] i, j []; i = new int [3]; j = new int [2] [3];
?
??