Question: Question 1 3 pts (TCOs 1, 3, and 6) Which of the following statements is false? A constructor is required to be written for every
Question 1 3 pts (TCOs 1, 3, and 6) Which of the following statements is false? A constructor is required to be written for every class.
The name of the constructor must be the same as the name of the class.
A constructor can be used to initialize instance variables.
A class can have multiple constructors with different parameter lists.
Question 2 3 pts (TCOs 1, 3, and 6) The data returned by JOptionPane.showInputDialog method is always _____ datatype. int
String
double
None of the above
Question 3 3 pts (TCOs 1, 3, and 6) Which statement displays a JFrame object named frame? frame.setVisible(true);
frame.setVisible();
frame.showFrame();
frame.showFrame(true);
Question 4 3 pts (TCOs 1, 3, and 6) Suppose a JFrame uses GridLayout(0,2). If you add six buttons to the frame, how many rows are displayed? 1
2
3
4
Question 5 3 pts (TCOs 1, 3, and 6) Object-oriented programming allows you to derive new classes from existing classes. This is called composition.
interfaces.
inheritance.
polymorphism.
Question 6 3 pts (TCOs 1, 3, and 6) Event handlers are implemented using the java concept of composition.
inheritance.
interfaces.
polymorphism.
Question 7 3 pts (TCOs 1, 3, and 6) The GUI library for Java that is newer and provides a uniform look and feel across platforms is Swing.
JavaFX.
AWT.
SWT.
Question 8 3 pts (TCOs 1, 3, and 6) Which method must be used to register the event handler called eHandler to a JButton component called btnNew? btnNew.setHandler(eHandler);
btnNew.addActionListener(eHandler);
eHandler.addActionListener(btnNew);
btnNew.eHandler();
Question 9 3 pts (TCOs 1, 3, and 6) Which of the following statements will display Hello World in a label named lblMessage? lblMessage.setLabel(Hello World);
lblMessage(Hello World);
lblMessage.setText(Hello World);
lblMessage.getText(Hello World
Question 10 3 pts (TCOs 1, 3, and 6) Every event object has the _____ method that can be used to identify the component that triggered the event. getSource()
getAction()
getTrigger()
getComponent()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
