多选题class A { protected int method1(int a, int b) { return 0; } } Which two are valid in a class that extends class A?()Apublic int method1(int a, int b) { return 0; }Bprivate int method1(int a, int b) { return 0; }Cprivate int method1(int a, long b) { return 0; }Dpublic short method1(int a, int b) { return 0: }Estatic protected int method1(int a, int b) { return 0; }
多选题
class A { protected int method1(int a, int b) { return 0; } } Which two are valid in a class that extends class A?()
A
public int method1(int a, int b) { return 0; }
B
private int method1(int a, int b) { return 0; }
C
private int method1(int a, long b) { return 0; }
D
public short method1(int a, int b) { return 0: }
E
static protected int method1(int a, int b) { return 0; }
参考解析
解析:
暂无解析
相关考题:
多选题Which three will compile and rim without exception?()Aprivate synchronized Object o;Bvoid go() { synchronized() { /* code here */ } }Cpublic synchronized void go() { /* code here */ }Dprivate synchronized(this) void go() { /* code here */ }Evoid go() { synchronized(Object.class) { /* code here */ } }Fvoid go() { Object o = new Object(); synchronized(o) { /* code here */ } }
单选题package foo; import java.util.Vector; private class MyVector extends Vector { int i = 1; public MyVector() { i = 2; } } public class MyNewVector extends MyVector { public MyNewVector () { i = 4; } public static void main (String args ) { MyVector v = new MyNewVector(); } } The file MyNewVector.java is shown in the exhibit. What is the result?()A Compilation will succeed.B Compilation will fail at line 5.C Compilation will fail at line 6.D Compilation will fail at line 14.E Compilation will fail at line 17.
单选题1. class A { 2. public byte getNumber () { 3. return 1; 4. } 5. } 6. 7. class B extends A { 8. public short getNumber() { 9. return 2; 10. } 11. 12. public static void main (String args[]) { 13. B b = new B (); 14. System.out.printIn(b.getNumber()) 15. } 16. } What is the result?()A Compilation succeeds and 1 is printed.B Compilation succeeds and 2 is printed.C An error at line 8 causes compilation to fail.D An error at line 14 causes compilation to fail.E Compilation succeeds but an exception is thrown at line 14.
多选题public class TestString3 { public static void main(String[] args) { // insert code here System.out.println(s); } } Which two code fragments, inserted independently at line 3, generate the output 4247?()AString s = “123456789”; s = (s-”123”).replace(1,3,”24”) - “89”;BStringBuffer s = new StringBuffer(”123456789”); s.delete(0,3).replace( 1,3, “24”).delete(4,6);CStringBuffer s = new StringBuffer(”123456789”); s.substring(3,6).delete( 1 ,3).insert(1, “24”);DStringBuilder s = new StringBuilder(”123456789”); s.substring(3,6).delete( 1 ,2).insert( 1, “24”);EStringBuilder s = new StringBuilder(”123456789”); s.delete(0,3).delete( 1 ,3).delete(2,5).insert( 1, “24”);
单选题public class Test { public static void main (Stringargs) { String foo = args[1]; String bar = args; String baz = args; System.out.printIn(“baz = ” + baz); } } And the output: Baz = 2 Which command line invocation will produce the output?()A Java Test 2222B Java Test 1 2 3 4C Java Test 4 2 4 2D Java Test 4 3 2 1
单选题11. class Payload { 12. private int weight; 13. public Payload(int wt) { weight = wt; } 13. public void setWeight(mt w) { weight = w; } 15. public String toString { return Integer.toString(weight); } 16. } 17. 18. public class TestPayload { 19. static void changePayload(Payload p) { 20. /* insert code here */ 21. } 22. 23. public static void main(String[] args) { 24. Payload p = new Payload(); 25. p.setWeight(1024); 26. changePayload(p); 27. System.out.println(”The value of p is “+ p); 28. } 29. } Which statement, placed at line 20, causes the code to print “The value of p is 420.”?()A p.setWeight(420);B p.changePayload(420);C p = new Payload(420);D Payload.setWeight(420);E p = Payload.setWeight(420);F p = new Payload(); p.setWeight(420);
单选题Given the following code fragment: 1) String str = null; 2) if ((str != null) (str.length() 10)) { 3) System.out.println("more than 10"); 4) } 5) else if ((str != null) (str.length() 5)) { 6) System.out.println("less than 5"); 7) } 8) else { System.out.println("end"); } Which line will cause error?()A line 1B line 2C line 5D line 8
单选题11. public class Test { 12. public void foo() { 13. assert false; 14. assert false; 15. } 16. public void bar(){ 17. while(true){ 18. assert false; 19. } 20. assert false; 21. } 22. } What causes compilation to fail?()A Line 13B Line 14C Line 18D Line 20
单选题Which method is an appropriate way to determine the cosine of 42 degrees?()A Double d = Math.cos(42);B Double d = Math.cosine(42);C Double d = Math.cos(Math.toRadians(42));D Double d = Math.cos(Math.toDegrees(42));E Double d = Math.cosine(Math.toRadians(42));