Professional Documents
Culture Documents
com Page 1 of 3
Class XII q. adding values of two objects into third object
a=s1.a+s2.a;
b=s1.b+s2.b;
}
} // end class
st3.add2obj(st1, st2);
st1.printvar();
st2.printvar();
st3.printvar();
}
Class XII subhashv1224@gmail.com Page 2 of 3
Class XII Q. A class that will swap two numbers as well as increment the value of its data
members by 1.
void printvar(){
System.out.println("x= "+ x + " y= "+y);
}
public SwapByRef(int f,int s){ // parameterized constructor
x=f;
y=s;
}
*** create a jFrame form and code the following behind two buttons: