int x=1;
int y=x;
System.out.println(y);
x=20;
System.out.println(y);
Obviously the program will print 1 and 1. However, I need to create a reference between x and y so every time i change x, y will be changed as well.
int x=1;
int y=x;
System.out.println(y);
x=20;
System.out.println(y);
Obviously the program will print 1 and 1. However, I need to create a reference between x and y so every time i change x, y will be changed as well.