Skip to content

Adding new Code #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CCVT_Code_Distribute/src/com/rt/anonomousclass/Greeting.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.rt.anonomousclass;

public interface Greeting {

public void print();

}
12 changes: 12 additions & 0 deletions CCVT_Code_Distribute/src/com/rt/anonomousclass/Temp.java
Original file line number Diff line number Diff line change
@@ -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");
}


}
24 changes: 24 additions & 0 deletions CCVT_Code_Distribute/src/com/rt/anonomousclass/TestClass.java
Original file line number Diff line number Diff line change
@@ -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();

}

}
12 changes: 11 additions & 1 deletion CCVT_Code_Distribute/src/com/rt/cloning/Employee.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}



Expand Down
9 changes: 5 additions & 4 deletions CCVT_Code_Distribute/src/com/rt/cloning/TestClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

}