I have wrote C# few years and start to learn java,
today i saw a sample is strange ,which is cannot happen in C#.
from
http://www.java2s.com/Tutorial/Java/0261%5F%5F2D-Graphics/Drawrectangles.htm
public class MainClass extends JFrame {
public static void main(String[] a){
MainClass f = new MainClass();
f.setSize(300,300);
f.setVisible(true);
}
public void paint(Graphics g) {
g.drawRect(10, 10, 60, 50);
g.fillRect(100, 10, 60, 50);
g.drawRoundRect(190, 10, 60, 50, 15, 15);
g.fillRoundRect(70, 90, 140, 100, 30, 40);
}
}
the constructor paint() will be fire on main(), and the parameter - "g" haven't initialize anythings, is it a hidden feature on java but which is not legal on OOP ?