-
Notifications
You must be signed in to change notification settings - Fork 126
Expand file tree
/
Copy pathTestClass.java
More file actions
31 lines (28 loc) · 806 Bytes
/
TestClass.java
File metadata and controls
31 lines (28 loc) · 806 Bytes
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
package com.rt.cloning;
//I have added a comment
public class TestClass {
//changes done
/**
* @param args
* @throws CloneNotSupportedException
*/
public static void main(String[] args) throws CloneNotSupportedException {
// TODO Auto-generated method stub
Department d1=new Department(7, "HR");
Employee e1=new Employee(1, "Ram",d1);
Employee e2= e1.clone();
System.out.println(e1);
System.out.println(e2);
// e2.setEid(3);
e2.setEname("Shyam");
e2.getDep().setDid(8);
e2.getDep().setDname("Acc");
System.out.println(e1);
System.out.println(e2);
//new Employee().getEid();
System.out.println(e1 instanceof Cloneable);
System.out.println(e1.clone()!=e1);
System.out.println(e2.getClass()==e1.getClass());
System.out.println(e1.equals(e2));
}
}