1.java Four features: Abstraction, inheritance, encapsulation, polymorphism
constructor function:
http://blog.csdn.net/qq_33642117/article/details/51909346
2.java Data base type: byte short int long double float char Boolean,
Package Type: boolean,character,byte,short,integer,long,float,double
Integer: The value of an integer variable is not new to the object when it is between 128-127, but instead refers directly to the integer object in the constant pool
, when the value of the increment variable is not between-128-127, the new object is directly
public class Test03 {public static void Main (string[] args) { Integer f1 = +, F2 = +, F3 =, F4 = 150;
system.out.println (f1 = = F2);//result is true System.out.println (F3 = = F4);//result is False } }
3. Static code block: Static code block executes when the class loads and executes only once
PS: Loading An example before the new object:
public class Statictest {public static void main (string[] args) {new Test1 (); new Test1 ();}} Class Test1{public Test1 () {System.out.println ("Test1 constructor method"); Static{system.out.println ("I am a static block of code, first execute me!! ");}}
Execution results
I am static code block, first execute me!! Test1 Construction Method Test1 Construction Method
4.JVM in-memory stack stack heap method area
Stacks: Defining basic data variables, object references, and field saving of function calls
Heap: New keyword Create object GC (garbage collector management) main area
Both the method area and the heap are areas of memory shared by each thread,
String str = new string ("Hello");
STR is placed in the stack, the new string object is placed in the heap, and hello is placed in the constant pool of the method area
Https://www.cnblogs.com/dingyingsi/p/3760730.html
The difference between 5.StringBuffer and Stringbuider
StringBuffer supports concurrent operations, thread safety, multi-threading, role: string is immutable
Its properties are immutable, and when manipulated against a string object, it is possible to produce a large number of intermediate string objects, causing
So use the stringbuffer that can be changed
Stringbuider does not support concurrent operations, threads are unsafe, not suitable for multi-threading, high performance in single thread
Https://www.cnblogs.com/A_ming/archive/2010/04/13/1711395.html
Str.intern (): The string in the shared pool is compared to the external string s, if the shared pool already has
The string that is equal to it, the external string is not placed in the shared pool, and is returned in the shared pool.
String, if different, puts the outer string into the shared pool and returns a handle to its string
-------The advantage of doing this is to save space.
The constant pool does not already contain JVA characters, so the new JVA is placed in a constant pool, belongs to the same object, and returns True String S1 = new StringBuilder ("J"). Append ("va"). toString (); System.out.println (S1.intern () ==s1);//true //constant pool itself has a string Java so the return is not the same string S2.intern () returns the//java in a constant pool S2 is the character of new so it is not equal to return false String s2 = new StringBuilder ("Ja"). Append ("va"). toString (); System.out.println (S2.intern () ==s2);//false * *
6. Generic type:
Https://www.cnblogs.com/lwbqqyumidi/p/3837629.html
Java Fundamentals Summary (ongoing updates ....) )