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

Method main

day11/code/day11_Object/src/cn/itcast_01/StudentDemo.java:27–52  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

25 */
26public class StudentDemo {
27 public static void main(String[] args) {
28 Student s1 = new Student();
29 System.out.println(s1.hashCode()); // 2100664515
30 Student s2 = new Student();
31 System.out.println(s2.hashCode()); // 1237346925
32 System.out.println("------------");
33
34 Student s3 = new Student();
35 Class c = s3.getClass();
36 String name = c.getName();
37 System.out.println(name); // cn.itcast_01.Student
38 System.out.println("------------");
39
40 Student s4 = new Student();
41 // �����ֱ�����һ����������ƣ���ʵ������Ǹö�����õ�toString()��������ַ���
42 System.out.println(s4); // cn.itcast_01.Student@79f1d448
43 // System.out.println(s4.toString()); // cn.itcast_01.Student@79f1d448
44
45 // cn.itcast_01.Student@79f1d448
46 // String s = s4.getClass().getName() +"@"+
47 // Integer.toHexString(s4.hashCode());
48 // System.out.println(s);
49
50 Student s5 = new Student("����ϼ",28);
51 System.out.println(s5);
52 }
53}

Callers

nothing calls this directly

Calls 2

hashCodeMethod · 0.95
getNameMethod · 0.45

Tested by

no test coverage detected