diff --git a/CCVT_Code_Distribute/src/com/rt/anonomousclass/Greeting.java b/CCVT_Code_Distribute/src/com/rt/anonomousclass/Greeting.java new file mode 100644 index 0000000..2ca7415 --- /dev/null +++ b/CCVT_Code_Distribute/src/com/rt/anonomousclass/Greeting.java @@ -0,0 +1,7 @@ +package com.rt.anonomousclass; + +public interface Greeting { + + public void print(); + +} diff --git a/CCVT_Code_Distribute/src/com/rt/anonomousclass/Temp.java b/CCVT_Code_Distribute/src/com/rt/anonomousclass/Temp.java new file mode 100644 index 0000000..fe8deef --- /dev/null +++ b/CCVT_Code_Distribute/src/com/rt/anonomousclass/Temp.java @@ -0,0 +1,12 @@ +package com.rt.anonomousclass; + +public class Temp implements Greeting{ + + @Override + public void print() { + // TODO Auto-generated method stub + System.out.println("Hello World"); + } + + +} diff --git a/CCVT_Code_Distribute/src/com/rt/anonomousclass/TestClass.java b/CCVT_Code_Distribute/src/com/rt/anonomousclass/TestClass.java new file mode 100644 index 0000000..0eec2b7 --- /dev/null +++ b/CCVT_Code_Distribute/src/com/rt/anonomousclass/TestClass.java @@ -0,0 +1,24 @@ +package com.rt.anonomousclass; + +public class TestClass { + + public static void main(String[] args) { + // TODO Auto-generated method stub + + System.out.println("Hello"); + + Greeting obj=new Greeting(){ + + @Override + public void print() { + // TODO Auto-generated method stub + System.out.println("Hello World"); + + } + }; + + obj.print(); + + } + +} diff --git a/CCVT_Code_Distribute/src/com/rt/cloning/Employee.java b/CCVT_Code_Distribute/src/com/rt/cloning/Employee.java index 53eec55..31de5ef 100644 --- a/CCVT_Code_Distribute/src/com/rt/cloning/Employee.java +++ b/CCVT_Code_Distribute/src/com/rt/cloning/Employee.java @@ -57,7 +57,17 @@ protected Employee clone() throws CloneNotSupportedException { return temp; } - + @Override + public boolean equals(Object obj) { + // TODO Auto-generated method stub + Employee temp=(Employee) obj; + if(this.getEid()==temp.getEid()) + return true; + else + return false; + +// return super.equals(obj); + } diff --git a/CCVT_Code_Distribute/src/com/rt/cloning/TestClass.java b/CCVT_Code_Distribute/src/com/rt/cloning/TestClass.java index 7344422..5a97d07 100644 --- a/CCVT_Code_Distribute/src/com/rt/cloning/TestClass.java +++ b/CCVT_Code_Distribute/src/com/rt/cloning/TestClass.java @@ -13,18 +13,19 @@ public static void main(String[] args) throws CloneNotSupportedException { Employee e2= e1.clone(); - System.out.println(e1); System.out.println(e2); - e2.setEid(3); +// 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)); } }