Ok, let me say that I have a class called Pancake.
Pancake.java will look something like this:
public class Pancake {
public boolean shouldEat() {
return false;
}
}
Now I do not want to edit Pancake.java at all. All I want to do is change what returns shouldEat()from another class, such as "NotPancake.java".
I know that I had something like
public boolean eat = false;
I could just change this by doing something like Pancake.eat = true, but is there a way to change what returns shouldEat()without editing the class in a similar way?
Thank.
source
share