Writing Java Application Code | Module 2
Course Name: Writing Java Application Code (Java as a Second Language Specialization)
Course Link: Writing Java Application Code
These are Writing Java Application Code Week 2 Coursera Answers
Q1. Which of the following are not a set of class files for Java Windows development?
- Swing
- Abstract Windows Toolkit (AWT)
- Java Utils
Answer: Java Utils
Q2. A JFrame components is an example of _________ .
- a Close button
- a Scrollbar
- a class
- A base Window
Answer: A base Window
Q3. Which methods sets a component’s position?
- add
- locate
- setBounds
- grid
Answer: setBounds
Q4. Which component is the best fit for multiline text?
- JTextArea
- Dialog
- JButton
- JLabel
Answer: JTextArea
Q5. Calling setText(String str) method on a JTextField, will set the contents to __________ .
- null
- Returns an error
- Clears the JTextField
- The value for String str
Answer: The value for String str
These are Writing Java Application Code Week 2 Coursera Answers
Q6. With method enables a JFrame to close when the X in the upper right hand corner is clicked?
- System.exit
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
- No method
- close
Answer: setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
Q7. True or False: a JPanel is an example of a container class.
- True
- False
Answer: True
Q8. User actions are handled in which method?
- addPerformed(ActionEvent e)
- event()
- onClick
- Run()
Answer: addPerformed(ActionEvent e)
Q9. True or False: Only one component on a Java window can listen for user action.
- True
- False
Answer: False
Q10. Which method allows a components to listen for user action?
- addActionListenListener()
- takeActions()
- addEventListener()
- newUserActionsListen()
Answer: addActionListenListener()
These are Writing Java Application Code Week 2 Coursera Answers
More Weeks of the course: Click Here
More Coursera courses: https://progiez.com/coursera