Have a look at my code.
Here my main program goes ...
Now my question is the two lines here doing the same job.
Which one needs more headache?
Code:
public class MyClass{
private int a=0;
private int b=0;
MyClass(int a,int b){
this.a = a;
this.b = b;
}
public void setA(int a){
this.a = a;
}
public void setB(int b){
this.b = b;
}
public int getA(){return a;}
public int getB(){return b;}
}
Code:
public static void main(String a[]){
MyClass obj = new MyClass(100,100);
MyClass clone_obj = (MyClass)obj.clone();
}
Which one needs more headache?
Comment