单选题int i = 0; while (true) { if(i==4) { break; } ++i; } System.out.println(“i=”+i); What is the result?()A i = 0B i = 3C i = 4D i = 5E Compilation fails.
单选题
int i = 0; while (true) { if(i==4) { break; } ++i; } System.out.println(“i=”+i); What is the result?()
A
i = 0
B
i = 3
C
i = 4
D
i = 5
E
Compilation fails.
参考解析
解析:
暂无解析
相关考题:
单选题1. interface DoStuff2 { 2. float getRange(int low, int high); } 3. 4. interface DoMore { 5. float getAvg(int a, int b, int c); } 6. 7. abstract class DoAbstract implements DoStuff2, DoMore { } 8. 9. class DoStuff implements DoStuff2 { 10. public float getRange(int x, int y) { return 3.14f; } } 11. 12. interface DoAll extends DoMore { 13. float getAvg(int a, int b, int c, int d); } What is the result?()A The file will compile without error.B Compilation fails. Only line 7 contains an error.C Compilation fails. Only line 12 contains an error.D Compilation fails. Only line 13 contains an error.E Compilation fails. Only lines 7 and 12 contain errors.F Compilation fails. Only lines 7 and 13 contain errors.G Compilation fails. Lines 7, 12, and 13 contain errors.
单选题1. class Exc0 extends Exception { } 2. class Exc1 extends Exc0 { } 3. public class Test { 4. public static void main(String args[]) { 5. try { 6. throw new Exc1(); 7. } catch (Exc0 e0) { 8. System.out.println(“Ex0 caught”); 9. } catch (Exception e) { 10. System.out.println(“exception caught”); 11. } 12. } 13. } What is the result?()A Ex0 caughtB exception caughtC Compilation fails because of an error at line 2.D Compilation fails because of an error at line 6.
多选题10. interface Jumper { public void jump(); } ...... 20. class Animal {} ...... 30. class Dog extends Animal { 31. Tail tail; 32. } ...... 40. class Beagle extends Dog implements Jumper { 41. public void jump() { } 42. } ....... 50. class Cat implements Jumper { 51. public void jump() { } 52. } Which three are true?()ACat is-a AnimalBCat is-a JumperCDog is-a AnimalDDog is-a JumperECat has-a AnimalFBeagle has-a TailGBeagle has-a Jumper
多选题public class Key { private long id1; private long 1d2; // class Key methods } A programmer is developing a class Key, that will be used as a key in a standard java.util.HashMap. Which two methods should be overridden to assure that Key works correctly as a key?()Apublic int hashCode()Bpublic boolean equals(Key k)Cpublic int compareTo(Object o)Dpublic boolean equals(Object o)Epublic boolean compareTo(Key k)
单选题Which will declare a method that is available to all members of the same package and can be referenced without an instance of the class?()A Abstract public void methoda();B Public abstract double methoda();C Static void methoda(double d1){}D Public native double methoda() {}E Protected void methoda(double d1) {}
多选题Integer i = new Integer (42); Long 1 = new Long (42); Double d = new Double (42.0); Which two expressions evaluate to True? ()A(i ==1)B(i == d)C(d == 1)D(i.equals (d))E(d.equals (i))F(i.equals (42))
单选题An instance member()Ais also called a static memberBis always a variableCis never a methodDbelongs to a single instance, not to the class as a wholeEalways represents an operation
多选题Which of these are keywords in Java?()AdefaultBNULLCStringDthrowsElong