Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Beginning Java with NetBeans: Chapter 13 How to work with inner classes, enumerations, and documentation MULTIPLE CHOICE [Answers are in tables delete all but the

Beginning Java with NetBeans: Chapter 13

How to work with inner classes, enumerations, and documentation

MULTIPLE CHOICE [Answers are in tables delete all but the correct answers cell]

1. What can you call an inner class that doesnt have a name?

a. an interface

b. an anonymous class

c. a public class

d. an event class

2. An inner class can be coded

a. within a class

b. within an abstract method of a class

c. within an enumeration

d. all of the above

3. An inner class cant

a. access variables and methods of its outer class

b. contain instance variables

c. contain regular methods

d. contain static methods

4. What does the following code do?

JButton button1 = new JButton("Test Button"); button1.addActionListener(new ActionListener() {

@Override public void actionPerformed(ActionEvent e) {

System.out.println("Button 1 clicked!"); }

});

a. use an enumeration to implement the ActionListener interface

b. use an anonymous classs to implement the ActionListener interface

c. use an enumeration to implment the ActionEvent interface

d. use an anonymous class to implment the ActionEvent interface

5. Each constant within an enumeration is assigned

a. an integer value beginning with zero

b. an integer value beginning with one

c. the integer value you specify

d. the String object you specify

6. Which of the following can you not do with an enumeration?

a. Declare a variable as an enumeration type

b. Use an enumeration as a parameter type

c. Use an integer in place of a constant defined by an enumeration

d. Store an enumeration in its own file

7. An enumeration inherits methods from which of the following classes?

a. java.lang.Object

b. java.lang.Enum

c. both a and b

d. neither a nor b

8. Which of the following is a benefit of using javadoc comments?

a. They make your classes easier to debug.

b. They allow other programmers to view the source code for your class.

c. They make it easy for other programmers to learn about your class.

d. They show other programmers how to code a class.

9. Which of the following is a valid javadoc comment?

a. // Calculates the balance due //

b. /* Calculates the balance due */

c. /* Calculates the balance due **/

d. /** Calculates the balance due */

10. Which of the following is not true about generated Java documentation?

a. It indicates the package that a class belongs to.

b. It lists all public methods of the class.

c. It includes the code that implements each documented method.

d. It lets you view classes by package.

11. Where must you code the javadoc comment for a method?

a. Before the class declaration

b. Before the method declaration

c. After the method declaration but before the first statement in the method

d. After the closing brace for the method

12. In what type of file is javadoc documentation stored?

a. class file

b. java file

c. html file

d. txt file

COMPLETION

13. Enumerations are ________________, which means that you cant pass an int value to a method parameter that specifies an enumeration.

14. You can use ________________ within a javadoc comment to apply formatting to the text when its displayed.

15. To include documentation for parameters and return types in javadoc documentation, you use ________________ tags.

16. To view javadoc documentation, you use a ________________.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions