Correct the syntax errors in the following program and add anyadditional stateme
ID: 3608404 • Letter: C
Question
Correct the syntax errors in the following program and add anyadditional statements necessary to make the program work: import javax.jswing.*; public class ROne extends JFrame { static private final int WIDTH= 400; static private final intHEIGHT = 300; publicRectangleProgramOne( ) { setTitle("Welcome"); setSize(WIDTH, HEIGHT); SetVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); } public static void main(String args[ ]); { ROner1 = r1 ( ) ; } } Correct the syntax errors in the following program and add anyadditional statements necessary to make the program work: import javax.jswing.*; public class ROne extends JFrame { static private final int WIDTH= 400; static private final intHEIGHT = 300; publicRectangleProgramOne( ) { setTitle("Welcome"); setSize(WIDTH, HEIGHT); SetVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); } public static void main(String args[ ]); { ROner1 = r1 ( ) ; } }Explanation / Answer
//Hope this will help you.. import javax.swing.*; //forJFrame public class ROne extends JFrame { static private final int WIDTH =400; static private final int HEIGHT =300; public ROne() /* Constructorname is always same as Class */ { setTitle("Welcome"); setSize (WIDTH, HEIGHT); setVisible(true); setDefaultCloseOperation (EXIT_ON_CLOSE); } public static void main (Stringargs[ ]) { ROne r1 = new ROne ( ) ; /* Object createdwith new ClassName */ } }