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

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

Want to excel in Java? Test your knowledge with our ultimate quiz based on 'Thinking in Java'. Engage with multiple-choice questions and in-depth explanations. Boost your understanding and prepare for your exam with confidence.

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.


What is required to change SWT widget properties not set by the constructor?

  1. Reconstruction of the widget

  2. Setter methods

  3. Direct property access

  4. Restarting the application

The correct answer is: Reconstruction of the widget

To change SWT widget properties not set by the constructor, it is necessary to reconstruct the widget. This means creating a new instance of the widget with the desired property changes. Option C, direct property access, may work for other types of widgets, but it is not possible with SWT widgets. Option B, using setter methods, is also not possible as most SWT widgets do not have setter methods for their properties. Option D, restarting the application, does not change the properties of the widget and is not a viable option.