I dont know whats the correct input to print so that my output can be the int values of x,y and a instead of memory space.
public class IntObject{
public int num;
public IntObject() {
num=0;
}
public IntObject(int n){
num=n;
}
public void increment() {
num++;
}
}
public class IntObjectTest{
public static IntObject someMethod(IntObject obj) {
IntObject ans =obj;
ans.increment();
return ans;
}
public static void main(String[]args) {
IntObject x = new IntObject(2);
IntObject y = new IntObject(7);
IntObject a =y;
x=someMethod(y);
a=someMethod(x);
System.out.print(x);
System.out.print(y);
System.out.print(a);
}
}
What can I do to change so that I can get the int values?