Review Questions |
4.20 |
Which statements are true about the use of modifiers?
Select the two correct answers.
|
4.21 |
Given the following source code, which comment line can be uncommented without introducing errors?
abstract class MyClass { abstract void f(); final void g() {} // final void h() {} // (1) protected static int i; private int j; } final class MyOtherClass extends MyClass { // MyOtherClass(int n) { m = n; } // (2) public static void main(String[] args) { MyClass mc = new MyOtherClass(); } void f() {} void h() {} // void k() { i++; } // (3) // void l() { j++; } // (4) int m; } Select the one correct answer.
|
4.22 |
What would be the result of attempting to compile and run the following program?
class MyClass { static MyClass ref; String[] arguments; public static void main(String[] args) { ref = new MyClass(); ref.func(args); } public void func(String[] args) { ref.arguments = args; } } Select the one correct answer.
|
4.23 |
Given the following member declarations, which statement is true?
int a; // (1) static int a; // (2) int f() { return a; } // (3) static int f() { return a; } // (4) Select the one correct answer.
|
4.24 |
Which statement is true?
Select the one correct answer.
|
4.25 |
What, if anything, is wrong with the following code?
abstract class MyClass { transient int j; synchronized int k; final void MyClass() {} static void f() {} } Select the one correct answer.
|
4.26 |
Which one of these is not a legal member declaration within a class?
Select the one correct answer.
|
4.27 |
Which statements are true about modifiers?
Select the two correct answers.
|
4.28 |
Which statement is true?
Select the one correct answer.
|