public class KeyWordExtends extends JFrame { public void bla () { setSize(400, 500); setVisible(true); } public static void main(String[] args) { KeyWordExtends extend = new KeyWordExtends(); extend.bla(); } }
the class KeyWordExtends is a subclass of the JFrame?
does it mean . that this class is an INSTANCE of the JFrame class?
so thats why this class shows a JFrame window.....
without declaring an object for the JFrame?
and how bout this one
public class NewClass extends JFrame { JFrame frame; JButton button; JPanel panel; public void sample() { frame = new JFrame("Sample"); frame.setDefaultCloseOperation(NewClass.EXIT_ON_CLOSE); // is this a new class of the JFrame class? frame.setSize(500, 500); frame.setVisible(true); frame.getContentPane().add(panel); } public static void main(String[] args) { NewClass object = new NewClass(); object.sample(); } }
NewClass is a new class for the JFrame class?, so it can access any static methods or fields of the JFrame class?
frame.setDefaultCloseOperation(NewClass.EXIT_ON_CLOSE); // is this a new class of the JFrame class?