Mastering Java: The Ultimate Quiz for 'Thinking in Java'

Disable ads (and more) with a membership for a one time $2.99 payment

Dive into the depths of Java with our quiz based on "Thinking in Java, Fourth Edition" by Bruce Eckel. Test your knowledge, solidify concepts, and prepare for certification with challenging questions and insightful feedback.

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


In SWT, what must you do after creating widgets to display the application window?

  1. Call the display() method

  2. Invoke the open() method on Shell

  3. Set the visibility to true

  4. Compile the widgets

The correct answer is: Call the display() method

After creating widgets in SWT, you must call the display() method to actually display them in the application window. Option B is incorrect because the open() method is used to open a shell (a top-level window in SWT) that has already been created. Option C is incorrect because setting the visibility to true would not actually display the application window but only make it visible after it has been displayed. Option D is incorrect because there is no compilation involved in creating and displaying widgets in SWT, as SWT is a GUI framework and not a programming language. Therefore, the correct answer is A.