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

Method main

day11/code/day11_Object/src/cn/itcast_03/StudentDemo.java:7–25  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

5 */
6public class StudentDemo {
7 public static void main(String[] args) throws CloneNotSupportedException {
8 Student s1 = new Student("����ϼ", 28);
9
10 Object obj = s1.clone();
11 Student s2 = (Student) obj;
12
13 System.out.println(s1.getName() + "---" + s1.getAge());
14 System.out.println(s2.getName() + "---" + s2.getAge());
15
16 Student s3 = s1;
17 System.out.println(s3.getName() + "---" + s3.getAge());
18 System.out.println("--------------------------------");
19
20 s1.setName("������");
21
22 System.out.println(s1.getName() + "---" + s1.getAge());
23 System.out.println(s2.getName() + "---" + s2.getAge());
24 System.out.println(s3.getName() + "---" + s3.getAge());
25 }
26}

Callers

nothing calls this directly

Calls 4

cloneMethod · 0.95
getNameMethod · 0.95
getAgeMethod · 0.95
setNameMethod · 0.95

Tested by

no test coverage detected