Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
131 views
in Programming by (98.5k points)
closed by

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?


1. f1.setClear(true);
2. f1.setVisible(true);
3. f1.setlook(true);
4. f1.setclean(true);

1 Answer

0 votes
by (95.6k points)
selected by
 
Best answer
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

Related questions

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...