Skip to content

Commit 5d6ebe6

Browse files
committed
✨ Introducing new features. ClassLoader
1 parent 95c9caa commit 5d6ebe6

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.crossoverjie.classloader;
2+
3+
/**
4+
* Function:
5+
*
6+
* @author crossoverJie
7+
* Date: 05/03/2018 23:11
8+
* @since JDK 1.8
9+
*/
10+
public class ChildClass extends SuperClass {
11+
static {
12+
System.out.println("ChildClass init");
13+
}
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.crossoverjie.classloader;
2+
3+
/**
4+
* Function:
5+
*
6+
* @author crossoverJie
7+
* Date: 05/03/2018 23:12
8+
* @since JDK 1.8
9+
*/
10+
public class Main {
11+
public static void main(String[] args) {
12+
System.out.println(ChildClass.A);
13+
}
14+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.crossoverjie.classloader;
2+
3+
/**
4+
* Function:
5+
*
6+
* @author crossoverJie
7+
* Date: 05/03/2018 23:11
8+
* @since JDK 1.8
9+
*/
10+
public class SuperClass {
11+
12+
/**
13+
* 如果使用了 final 修饰的常量,再使用时父类也不会初始化
14+
*/
15+
public static int A = 1;
16+
17+
static {
18+
System.out.println("SuperClass init");
19+
}
20+
}

0 commit comments

Comments
 (0)