MCPcopy Create free account
hub / github.com/DuGuQiuBai/Java / main

Method main

day16/code/day16_Generic/src/cn/itcast_02/ToolTest.java:10–32  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

8 */
9public class ToolTest {
10 public static void main(String[] args) {
11 Student s = new Student();
12 Teacher t = new Teacher();
13
14 // Tool t = new Tool();
15 // t.setStudent(s);
16 // Student ss = t.getStudent();
17 // ss.love();
18
19 Tool tool = new Tool();
20 // ����ΪStudent
21 tool.setObj(s);
22 Student ss = (Student) tool.getObj();
23 ss.love();
24
25 // ����ΪTeacher
26 tool.setObj(t);
27 Teacher tt = (Teacher) tool.getObj();
28 tt.love();
29
30 Student sss = (Student) tool.getObj();
31 sss.love();
32 }
33}

Callers

nothing calls this directly

Calls 4

setObjMethod · 0.95
getObjMethod · 0.95
loveMethod · 0.95
loveMethod · 0.95

Tested by

no test coverage detected