In the given Program: class Dialog1 { public static void main(String args[]) { Frame f1 = new Frame("INDIA"); f1.setSize(300,300); f1.setVisible(true); FileDialog d = new FileDialog(f1, "MyDialog"); d.setVisible(true); String fname = d.getDirectory() + d.getFile(); System.out.println("The Selection is" + fname); } } To make the Frame visible, which of the following statements are true?

In the given Program: class Dialog1 { public static void main(String args[]) { Frame f1 = new Frame("INDIA"); f1.setSize(300,300); f1.setVisible(true); FileDialog d = new FileDialog(f1, "MyDialog"); d.setVisible(true); String fname = d.getDirectory() + d.getFile(); System.out.println("The Selection is" + fname); } } To make the Frame visible, which of the following statements are true? Correct Answer f1.setVisible(true);

class Dialog1

{

public static void main(String args)

{

Frame f1 = new Frame("INDIA");

f1.setSize(300,300);   //setSize(300,300) method of JFrame makes the rectangular area 300 pixels wide by 300 pixels high. The default size of a frame is 0 by 0 pixels

f1.setVisible(true);   //The setVisible(true) method makes the frame appear on the screen. If you forget to do this, the frame object will exist as an object in memory, but no picture will appear on the screen. 

FileDialog d = new FileDialog(f1, "MyDialog");

d.setVisible(true);

String fname = d.getDirectory() + d.getFile();

System.out.println("The Selection is" + fname);

}

}

Hence the correct answer is option 2

Related Questions

What will be the output when the following program is compiled and executed? abstract class TestAbstract{ String my_name; String myName(){ my_name = "Examveda"; return my_name; } abstract void display(); } public class Test extends TestAbstract{ void display(){ String n = myName(); System.out.print("My name is "+ n); } public static void main(String args[]){ Test t = new Test(); t.display(); } }