Skip to content

Commit 9094d95

Browse files
realDuYuanChaogithub-actions
and
github-actions
authored
get supper class (examplehub#161)
* get supper class * Formatted with Google Java Formatter Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
1 parent a82d8cc commit 9094d95

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.examplehub.basics.reflection;
2+
3+
public class GetSupperClass {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.examplehub.basics.reflection;
2+
3+
import static org.junit.jupiter.api.Assertions.*;
4+
5+
import org.junit.jupiter.api.Test;
6+
7+
class GetSupperClassTest {
8+
@Test
9+
void test() {
10+
Class cls = Integer.class;
11+
assertEquals(Number.class, cls.getSuperclass());
12+
assertEquals(Object.class, cls.getSuperclass().getSuperclass());
13+
assertEquals(null, cls.getSuperclass().getSuperclass().getSuperclass());
14+
}
15+
}

0 commit comments

Comments
 (0)