Logo Passei Direto
Buscar
Material
páginas com resultados encontrados.
páginas com resultados encontrados.

Prévia do material em texto

Certified Java Programmer Mock Exam 79
 System.out.print(A.super.s1); // 5 
 } 
 } 
 public static void main (String[] args) { 
 new A().new B().m1(); // 6 
 } 
} 
What is the result of attempting to compile and run the above program? 
a. Prints: B,SuperB,B,SuperB 
b. Prints: B,SuperB,A,SuperA 
c. Compiler Error at 1. 
d. Compiler Error at 2. 
e. Compiler Error at 3. 
f. Compiler Error at 4. 
g. Compiler Error at 5. 
h. Compiler Error at 6. 
i. Runtime Error 
j. None of the Above 
Capítulo 7 – Inner Classes (A) 
 
Question 1 
abstract class A { // 1 
 abstract static void m1(); // 2 
 abstract static class B {} // 3 
 static class C extends B {} // 4 
} 
Compiler errors are generated at which of the following lines? 
a. 1 
b. 2 
c. 3 
d. 4 
e. None of the Above 
 
Question 2 
abstract class A { 
 private int x = 4; 
 private int y = 2; 
 public int x() {return x;} 
 public void x(int x) {this.x = x;} 
 public int y() {return y;} 
 public void y(int y) {this.y = y;} 
 public abstract int math(); 
} 
class B { 
 static A a1 = new A() {public int math() {return x()+y();}} 
 static A a2 = new A() {public int math() {return x()-y();}} 
 static A a3 = new A() {public int math() {return x()*y();}} 
 static A a4 = new A() {public int math() {return x()/y();}} 
 public static void main(String[] args) { 
 System.out.print("" + a1.math() + 
 a2.math() + 
 a3.math() + 
 a4.math()); 
 } 
} 
What is the result of attempting to compile and run the program? 
a. Prints: 18 
b. Prints: 6282 
c. Compile-time error. 
d. Run-time error. 
e. None of the Above. 
 
Question 3 
class Z { 
 void m1() { 
 abstract class A {} // 1 
 final class B {} // 2 
 private class C {} // 3 
 protected class D {} // 4 
 public class E {} // 5 
 static class F {} // 6 
 synchronized class G {} // 7 
 transient class H {} // 8 
 volatile class I {} // 9 
 strictfp class J {} // 10 
 }

Mais conteúdos dessa disciplina