请问这段Java代码的执行机制是什么?
class Glyph {
void draw() {
System.out.println("Glyph.draw()");
}
Glyph() {
System.out.println("Glyph() before draw()"); //①
draw(); //②
System.out.println("Glyph() after draw()"); //③
}
}
class RoundGlyph extends Glyph {
private int radius = 1;
RoundGlyph(int r) {
radius = r;
System.out.println("RG.RoundGlyph(), radius = " + radius); //④ radius = 5
}
void draw() { // 重写
System.out.println("RG.draw(), radius = " + radius); //② radius = 0
}
}
public class PolyConstruct {
public static void main(String[] args) {
new RoundGlyph(5);
}
}
//方法重写在父类对象构造之前还是之后?