Yes it is!!One solution to your problem could be this
Code:
public class MainClass{
private int var1
private int var2
public void method(){
AnotherObject obj=new AnotherObject()
obj.setValue1(var1)
obj.setValue2(var2)
}
}
public class AnotherObject{
private int value1
private int value2
public void setValue1(int value){
value1=value
}
public void setValue2(int value){
value2=value
}
//other methods go here
}
--------------------
reach whatever you can't reach(N.Kazantzakis)