Select all that applies 1Which of the following is poor desi
Select all that applies
1.Which of the following is poor design?
A data field is derived from other data fields in the same class.
A method must be invoked after/before invoking another method in the same class.
A method is an instance method, but it does not reference any instance data fields or invoke instance methods.
A parameter is passed from a constructor to initialize a static data field.
2. To declare a class named A with two generic types, use ________.
public class A { ... }
public class A { ... }
public class A(E) { ... }
public class A(E, F) { ... }
Select all that apply
3. Which of the following statements are true?
Inner classes can make programs simple and concise.
An inner class can be declared public or private subject to the same visibility rules applied to a member of the class.
An inner class can be declared static. A static inner class can be accessed using the outer class name. A static inner class cannot access nonstatic members of the outer class.
An inner class supports the work of its containing outer class and is compiled into a class named OuterClassName$InnerClassName.class
| A data field is derived from other data fields in the same class. | ||||||||||||||||||||||||||
| A method must be invoked after/before invoking another method in the same class. | ||||||||||||||||||||||||||
| A method is an instance method, but it does not reference any instance data fields or invoke instance methods. | ||||||||||||||||||||||||||
| A parameter is passed from a constructor to initialize a static data field. 2. To declare a class named A with two generic types, use ________.
|
Solution
1.c.A method is an instance method, but it does not reference any instance data fields or invoke instance methods
A parameter is passed from a constructor to initialize a static data field.
2,
public class A<E, F> { ... }
3.
An inner class can be declared static. A static inner class can be accessed using the outer class name. A static inner class cannot access nonstatic members of the outer class.
An inner class supports the work of its containing outer class and is compiled into a class named OuterClassName$InnerClassName.class