This is the code:
import acm.program.*;
public class test extends GraphicsProgram{
public test(){
println(getHeight());
}
public void run(){
println(getHeight());
}
}
The executed result is 0 472
. Why does getHeight()
in the constructor return 0
, whereas run()
returns 472
, which is the real value?