阿摩線上測驗
登入
首頁
>
OJCP(SCJP)
>
104年 - SCJP 51-100#99391
>
52. Place the code fragments in position to complete the Displayable interface.
其他申論題
(1)女性主義學者基里艮(C. Gilligan)主要是反對哪位學者的學說?(2分)
#415590
(2)基里艮的立場屬於何種倫理學?(2分)
#415591
(3)又,基里艮將女性道德發展分為哪三階段?(6分)
#415592
4. 請提出四種新住民子女的學習問題並說明之(4分)?另,提出三種政府應提出的解決策略並說明之(6分)?
#415593
53. Insert six modifiers into the code such that it meets all of these requirements: 1. It must be possible to create instances of Alpha and Beta from outside the packages in which they are defined. 2. When an object of type Alpha (or any potential subclass of Alpha) has been created, the instance variable alpha may never be changed. 3. The value of the instance variable alpha must always be "A" for objects of type Alpha.
#415595
63. Given: 11. class ClassA{} 12. class ClassB extends ClassA{} 13. class ClassC extends ClassA{} and: 21. ClassA p0 = new ClassA(); 22. ClassB p1 = new ClassB(); 23. ClassC p2 = new ClassC(); 24. ClassA p3 = new ClassB(); 25. ClassA p4 = new ClassC(); Which three are valid? (Choose three.) (A) p0 = p1; (B) p1 = p2, (C) p2 = p4; (D) p2 = (ClassC)p1; (E) p1 = (ClassB)p3; (F) p2 = (ClassC)p4;
#415596
64. Given: class A { String name = "A"; String getName() { return name; } String greeting(){ return "class A"; } } class B extends A { String name = "B"; String greeting() { return "class B"; } } public class Client { public static void main( String[] args ) { A a = new A(); A b = new B(); System.out.println(a.greeting() + "has name" + a.getName()); System.out.println(b.greeting() + "has name" + b.getName()); } }
#415597
65. Replace two of the Modifiers that appear in the Single class to make the code compile. Note: Three modifiers will not be used and four modifiers in the code will remain unchanged. Code public class Single { private static Single instance; public static Single getInstance() { if (instance =
#415598
66. Given: 5. class Thingy{ Meter m = new Meter(); } 6. class Component {void go() { System.out.print("c");}} 7. class Meter extends Component {void go() { System.out.print("m"); }} 8. 9. class DeluxeThingy extends Thingy { 10. public static void main(String[] args) { 11. DeluxeThingy dt = new DeluxeThingy(); 12. dt.m.go(); 13. Thingy t = new DeluxeThingy(); 14. t.m.go(); 15. } 16. } Which two are true? (Choose two.) (A) The output is mm. (B) The output is mc. (C) Component is-a Meter. (D) Component has-a Meter. (E) DeluxeThingy is-a Component. (F) DeluxeThingy has-a Component.
#415599
71. Given: 1. interface A{public void aMethod();} JarB JarD JarE JarA JarC 2. interface B { public void bMethod(); } 3. interface C extends A, B { public void cMethod(); } 4. class D implements B { 5. public void bMethod(){} 6. } 7. class E extends D implements C { 8. public void aMethod(){} 9. public void bMethod(){} 10. public void cMethod(){} 11. } What is the result? (A) Compilation fails because of an error in line 3. (B) Compilation fails because of an error in line 7. (C) Compilation fails because of an error in line 9. (D) If you define D e = new E(), then e.bMethod() invokes the version of bMethod() defined in Line 5. (E) If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 5. (F) If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9.
#415600