Correct Answer - Option 2 : 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