Professional Documents
Culture Documents
Java Oop总结
Java Oop总结
1.
2.
a) -
b) -
3.
a) newnew
0
(byte,short,int,long,float,double)
False
boolean
/u0000
char
null
4.
a)
b) stack)
(heap)
5.
a)
1)
2)
3)
b)
1)
2)
3) new
6.
a)
b)
c)
d)
e) new
f) null
g) null NullPointerException
7. null
Example:
(Stack)
(Heap)
Cell
Row = 0
Col = 0
CC|0X1111
C|0X1111
c cc
Cell cc
c
1. 1 2
2. - +
3.
4. JAVA
overload)
a.a)
a.b)
1.
2.
3.
4.
5. void
6.
7.
this
1. this this
2. this
3. this.:
4. this.:
5. this() this()
1. JAVA
2.
3.
4. null, new
5. , JAVA
1. JVM
2. new
3.
a) new
b) JAVA
4.
a) Garbage Collection (GC) JVM ()
b)
c) JAVA GC
JAVA
1.
JAVA
2.
List list = new ArrayList(10);
for (int I = 0; i<100; i++){
Object o = new Object();
list.add(o);
o = null;
}
o null, list o
GC
d) GC
e) System.GC()
1.
2. JVM
3.
4.
1. .class
2. JAVA
3. .class
4.
1.
2. extends
3. (sub class)(super class)
4.
5.
a)
b)
c)
d)
e)
6.
7.
super
,
super()
NOTE
-> super()
super()
1) super(
super
2)
3)
super
1) this super(),super.(),super.(
)
2) this super
1.
2.
(Override)
1.
2. (+)(
)
3.
4. super.()
5.
5.A.
5.B.
5.C.
8. (Override)(Overload)
1.
2. ,
3. ,
1.
2.
3.
4.
5.
6.
package Java
:...
.
:
a) .
b) import package
1.
a)
b)
1)
2) ,
2.
a) public:
b) protected
c) ():
d) private:
e) public
f) :public,private,protected,
:protected private
(
static final
1. static
1. static
static
2. static static
2. static
1. static
2. .
3. static this
int num = p1.distance(p2){return this.coord p2.coord})
4. static static
3.
4.
5.
6.
7.
5. static
static
1.
2. (
3.
4.
final
1. final
2. final
3. final
final
1. final
2.
final
1. final
2.
static final
1.
2. (
3. all-capsstatic final
2. abstract ,
3.
4.
5. abstract final abstract final
6.
1.
2.
3.
4.
1.
2.
3.
4.
5.
6.
7.
8.
implements
extends
()
1. (e.g:
)
2. (e.g.
)
3.
a)
b)
Java
4.
a)
b)
ClassCastException() instanceof
1.
a) Inner(Outer) Outer
b) Inner Outer
c) Outer Inner
public Inner create(){
return this.new Inner()
}
this
2.
a) ()
b)
c)
public interface Action{
public void execute(); //Abstract method
}
public class Main{
public static void main(String[] args){
//start anonymous class definition
Action action = new Action(){
public void execute (){
System.out.println(Hello!);
};
action.execute();