chirp chirp
chirp hello
hello hello
编译失败
第1题:
执行下面程序后输出的正确结果是( )。 public class Test{ public static void main(String args[]){ System.out.print(100%3); System.out.print(","); System.out.print(100%0); } }
A.1,1
B.1,1.0
C.1.0, l
D.1.0,1.0
第2题:
A.编译错误
B.200
C.100200
D.100
第3题:
classBird{staticvoidtalk(){System.out.print("chirp");}}classParrotextendsBird{staticvoidtalk(){System.out.print("hello");}publicstaticvoidmain(String[]args){Bird[]birds={newBird(),newParrot()};for(Birdb:birds)b.talk();}}结果为:()
A.chirpchirp
B.chirphello
C.hellohello
D.编译失败
第4题:
class Flibitz { public static void main(String [] args) { int grop = 7; new Flibitz().go(grop); System.out.print(grop); } void go(int grop) { if(++grop 〉 7) grop++; System.out.print(grop); } } 结果为:()
第5题:
class BitStuff { BitStuff go() { System.out.print("bits "); return this; } } class MoreBits extends BitStuff { MoreBits go() { System.out.print("more "); return this; } public static void main(String [] args) { BitStuff [] bs = {new BitStuff(), new MoreBits()}; for( BitStuff b : bs) b.go(); } } 结果为:()
第6题:
下列程序的输出结果是 ( ) class Derao { void test() { Systeme.out.print("NO");} void test (int i) {System.out.print(a);} void test(int a,int b) {System.out.print(a+b);} } class Test { public static void main(String args[]) { Demo de=new Demo(); de.test(); de.test5.; de.test(6,8); } }
A.No568
B.568No
C.No514
D.86No5
第7题:
class One { public One() { System.out.print(1); } } class Two extends One { public Two() { System.out.print(2); } } class Three extends Two { public Three() { System.out.print(3); } } public class Numbers{ public static void main( String[] argv) { new Three(); } } What is the result when this code is executed?()
第8题:
现有:classBird{voidtalk(){System.out.print("chirp");}}classParrot2extendsBird{protectedvoidtalk(){System.out.print("hello");publicstaticvoidmain(String[]args){Bird[]birds={newBird(),newParrot2()};for(Birdb:birds)b.talk();}}结果是什么?()
A.chirpchirp
B.hellohello
C.chirphello
D.编译错误
第9题:
public class Base { public static final String FOO = “foo”; public static void main(String[] args) { Base b = new Base(); Sub s = new Sub(); System.out.print(Base.FOO); System.out.print(Sub.FOO); System.out.print(b.FOO); System.out.print(s.FOO); System.out.print(((Base)s).FOO); } } class Sub extends Base {public static final String FOO=bar;} What is the result?()
第10题:
现有: class Bird { void talk() { System.out.print("chirp "); } } class Parrot2 extends Bird { protected void talk() { System.out.print("hello "); public static void main(String [] args) { Bird [] birds = {new Bird(), new Parrot2 () }; for( Bird b : birds) b.talk () ; } } 结果是什么 ?()