-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.java
More file actions
57 lines (44 loc) · 1.3 KB
/
Copy pathStudent.java
File metadata and controls
57 lines (44 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import java.lang.reflect.*;
class Student {
private String name;
private int rollNo;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getRollNo() {
return rollNo;
}
public void setRollNo(int rollNo) {
this.rollNo = rollNo;
}
}
class Test{
public static void main(String[] args) throws ClassNotFoundException {
System.out.println("hello friends.........");
Teacher t = new Teacher();
System.out.println(String.class.getClassLoader());
System.out.println(Student.class.getClassLoader());
System.out.println(Test.class.getClassLoader());
System.out.println(Teacher.class.getClassLoader());
/*
* Class c; c = Class.forName("Student"); Field[]f = c.getDeclaredFields();
*
* for (Field field : f) { System.out.println("Field Name :- "+field); }
* System.out.println();
*
* Method[] m = c.getDeclaredMethods();
*
* for (Method m1 : m) { System.out.println("Method Name :- "+m1); }
*
* Student s1 = new Student(); Class c1 = s1.getClass();
*
* Student s2 = new Student(); Class c2 = s2.getClass();
*
* System.out.println(); System.out.println(c1.hashCode());
* System.out.println(c2.hashCode()); System.out.println(c.hashCode());
*/
}
}