I have a main class where the user enters data, after I would like to go to another class. I do not know how to go to next class and inherit values x and y in java code.
public class main {
int x=25;
int y =25;
//Go to next class second
}
public class second {
//inherit values of x and y
//manipulate values
//Go to next class third
}
public class third {
//inherit values of x and y from second class
//manipulate values
}
So you are not obligated to use inheritance.