Skip to content

Commit

Permalink
获得class的实例Java、Kotlin对比实现
Browse files Browse the repository at this point in the history
  • Loading branch information
BetterZhang committed Jun 29, 2017
1 parent 1ade651 commit 48aa302
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/com/betterzhang/learnkotlin/java/ClassZZ.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static void main(String[] args) {
ClassZZ c = new ClassZZ();
Class<?> clazz2 = c.getClass();
System.out.println(clazz2);
System.out.println(clazz2.getSimpleName());
}

}
1 change: 1 addition & 0 deletions src/com/betterzhang/learnkotlin/kotlin/ClassZZ.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class ClassZZ {
val c = ClassZZ()
val clazz2 = c.javaClass
println(clazz2)
println(clazz2.simpleName)
}
}

Expand Down

0 comments on commit 48aa302

Please sign in to comment.