网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
现有 class Beverage { Beverage () { System.out.print ("beverage "); } } class Beer extends Beverage { public static void main{string [] args) { Beer b = new Beer (14) ; } public int Beer(int x) { this () ; System.out.print ("beerl") ; } public Beer() { System.out.print("beer2 "); } } 结果是什么?()
- A、beerl beverage
- B、beer2 beverage
- C、beverage beer2 beerl
- D、编译失败
参考答案
更多 “ 现有 class Beverage { Beverage () { System.out.print ("beverage "); } } class Beer extends Beverage { public static void main{string [] args) { Beer b = new Beer (14) ; } public int Beer(int x) { this () ; System.out.print ("beerl") ; } public Beer() { System.out.print("beer2 "); } } 结果是什么?() A、beerl beverageB、beer2 beverageC、beverage beer2 beerlD、编译失败” 相关考题
考题
现有如下包结构:com|--x||--Alpha.class||||--y||--Beta.class||--Gamma.class和类:classTest{Alphaa;Betab;Gammac;}哪三个必须加入到类Test中,以使其通过编译?()
A.packagey;B.packagecom;C.importcom.x.*;D.importcom.x.y.*
考题
现有如F包结构:com|一一X||一一Alpha.class||||一一yI|一一Beta.class||l--Gamma.class和类:classTest{Alphaa;Betab;Gammac;}哪三个必须加入到类Test中,以使其通过编译?()
A.packagey;B.packagecom;C.importcom.x.y.*;D.importcom.x.*;
考题
现有两个类A,B,以下描述中表示B继承自A的是 ( )A.class A extends BB.class B implements AC.class A implements BD.class B extends A
考题
下面程序输出的结果为 #include"iostream.h" class A { public: A(){cout<<"CLASSA"<<endl;} ~A() {} }; class B:public A { public: B(){cout<<"CLASSB"<<endl;} ~B() {} }; void main() { A * p; p=new B; B *q; q=new B; }A.CLASS A CLASS BB.CLASS A CLASS B CLASS BC.CLASS A CLASS B CLASS A CLASS BD.CLASS A CLASS B CLASS B CLASS B
考题
下面程序输出的结果为#include"iostream.h"class A{public:A( ){cout<<"CLASS A"<<endl;}~A( ){}};class B:public A{public:B( ){cout<<"CLASS B"<<endl;}~B( ){}};void main( ){A*p;p=new B;B *q;q=new B;}A.CLASS A CLASS BB.CLASS A CLASS B CLASS BC.CLASS A CLASS B CLASS A CLASS BD.CLASS A CLASS B CLASS B CLASS B
考题
下面程序输出的结果为 #include"iostream.h” class A { public: A(){cout<<"CLASSA"<<endl;} ~A() {} }; class B:public A { public: B(){cout<<"CLASS B"<<endl;} ~B(){} }; void main() { A*p; p=new B;A.CLASS A CLASS B CLASS B CLASS BB.CLASS A CLASS B CLASS A CLASS BC.CLASS A CLASS B CLASS BD.CLASS A CLASS B
考题
下面程序输出的结果为( )。 #inClUde”iostream.h” Class A {public: A(){cout<<“CLASS A”<<endl;} ~A()<)}; class B:public A {public: B(){cout<<”CLASSB”<<endl;} ~B(){}}; void main() {A*p; p=new B; B *q; q=new B;}A.CLASS A CLASS BB.CLASS A CLASS B CLASS BC.CLASS A ClASS BD.CLASS A CLASS B CLASS A CLASS B CLASS B CLASS B
考题
对于下面( )类定义,可以通过“newJ_Class()”生成类J_Class的实例对象。A、publicclassJ_Class{publicJ_Class(void){}}B、publicclassJ_Class{}C、publicclassJ_Class{publicJ_Class(Strings){}}D、publicclassJ_Class{publicvoidJ_Class(){}publicJ_Class(Strings){}
考题
现有包结构: com |-- x | |-- Alpha.class | | | |-- y | |-- Beta.class | |-- Gamma.class 和类: //insert code here import com.*; import com.x.y.*; class Test { Alpha a; Beta b; Gamma c; } 哪两行分别插入后可允许代码编译?() A、package com.;B、import com.x;C、package com.x;D、import com.x.Alpha;
考题
现有: interface I { void go(); } abstract class A implements I { } class C extends A { void go(){ } } 结果是什么?() A、代码通过编译B、由于第1行的错误导致编译失败C、由于笫3行的错误导致编译失败D、由于第6行的错误导致编译失败
考题
现有如下包结构: com |-- x | |-- Alpha.class | | | |-- y | |-- Beta.class | |-- Gamma.class 和类: class Test { Alpha a; Beta b; Gamma c; } 哪三个必须加入到类 Test 中,以使其通过编译?()A、package y;B、package com;C、import com.x.*;D、import com.x.y.*
考题
现有: class Dog{ } class Harrier extends Dog { } class DogTest{ public static void main (String [] args) { Dog dl=new Dog(); Harrier hl=new Harrier(); Dog d2=hl; Harrier h2= (Harrier) d2; Harrier h3=d2; } } 下面哪一项是正确的?() A、2个Dog对象被创建B、2个Harrier对象被创建C、3个Harrier对象被创建D、编译失败
考题
现有: class TestApp{ public static void main (String[] args){ for (int i=0; iA、0123B、012456789C、0123456789D、012
考题
Which of the following class addresses is reserved for multicast?()A、 Class AB、 Class BC、 Class CD、 Class D
考题
现有: 1 Interface F{} 2 class A implements F{} 3 class B extends A{} 4 class C extends B{ 5 public static void main(String[] args){ 6 B b=new B(); 7 //inSert C0de here 8 } 9 } 下列哪行代码插入到第7行,将抛出java.lang.ClassCaseException异常()A、 A a=b;B、 F f= (C)b;C、 F f= (A)b;D、 B bb= (B)(A)b;
考题
现有: class A {public String name="a"} class B extends A {public String name="b"} 执行如下代码后的结果是哪项?() A a=new B(); System.out.println(a.name); A、 aB、 bC、编译失败D、运行时抛出异常
考题
现有: class Guy {String greet() {return "hi"; } } class Cowboy extends Guy ( String greet() ( return "howdy ¨; ) ) class Surfer extends Guy (String greet() (return "dude! ";)) class Greetings { public static void main (String [] args) { Guy [] guys = ( new Guy(), new Cowboy(), new Surfer() ); for (Guy g: guys) System.out.print (g.greet()}; } } 结果为:() A、 hi howdy dude!B、运行时异常被抛出。C、第7行出现一个错误,编译失败。D、第8行出现一个错误,编译失败。
考题
现有: class TestA { public void start() { System.out.println("TestA"); } } public class TestB extends TestA { public void start() { System.out.println("TestB"); } public static void main (string[] args) ( ((TestA)new TestB()).start(); ) } 运行结果是哪项?() A、 TeStAB、 TeStBC、编译失败D、运行时抛出异常
考题
单选题现有: interface Data {public void load();} abstract class Info {public abstract void load();} 下列类定义中正确使用Data和Info的是哪项?()A
public class Employee implements Info extends Data { public void load(){/*dosomething*/} }B
public class Employee extends Inf.implements Data{ public void load() {/*do something*/} }C
public class Empl.yee implements Inf extends Data{ public void Data.1oad(){* do something*/} public void load(){/*do something*/} }D
public class Employee extends Inf implements Data { public void Data.1oad() {/*do something*/) public void info.1oad(){/*do something*/} }
考题
单选题现有: 1. interface Animal { 2. void eat(); 3. } 4. 5. // insert code here 6. 7. public class HouseCat extends Feline { 8. public void eat() { } 9. } 和五个声明: abstract class Feline implements Animal { } abstract class Feline implements Animal { void eat(); } abstract class Feline implements Animal { public void eat(); } abstract class Feline implements Animal { public void eat() { } } abstract class Feline implements Animal { abstract public void eat(); } 分别插入到第5行,有几个可以通过编译?()A
0B
1C
2D
3
考题
单选题现有: class Guy { String greet() { return "hi"; } } class Cowboy extends Guy { String greet() { return. "howdy";}} class Wrangler extends Cowboy { String greet() { return "orch!"; } } class Greetings2 { public static void main (String [] args) { Guy g=new Wrangler(); Guy g2=new Cowboy(); Wrangler w2=new Wrangler(); System. out .print (g.greet()+g2.greet()+w2 .greet()); } } 结果是什么?()A
hi hi ouch!B
ouch! howdy ouch!C
hi howdy ouch!D
编译失败E
运行的咐候有异常抛出
考题
单选题现有: class Top { static int x=l; public Top (inty) { x*=3; } } class Middle extends Top { public Middle() {x+=1; ) public static void main (String [] args) { Middle m = new Middle(); System. out .println (x); } } 结果为:()A
1B
2C
3D
编译失败
考题
单选题现有: class TestA { public void start() { System.out.println("TestA"); } } public class TestB extends TestA { public void start() { System.out.println("TestB"); } public static void main (string[] args) ( ((TestA)new TestB()).start(); ) } 运行结果是哪项?()A
TeStAB
TeStBC
编译失败D
运行时抛出异常
考题
多选题现有: public class TestDemo{ private int X-2; static int y=3; public void method(){ final int i=100; int j =10; class Cinner { public void mymethod(){ //Here } } } } 在Here处可以访问的变量是哪些?()AXByCjDi
考题
单选题现有: class Guy {String greet() {return "hi"; } } class Cowboy extends Guy ( String greet() ( return "howdy ¨; ) ) class Surfer extends Guy (String greet() (return "dude! ";)) class Greetings { public static void main (String [] args) { Guy [] guys = ( new Guy(), new Cowboy(), new Surfer() ); for (Guy g: guys) System.out.print (g.greet()}; } } 结果为:()A
hi howdy dude!B
运行时异常被抛出。C
第7行出现一个错误,编译失败。D
第8行出现一个错误,编译失败。
考题
单选题现有: interface Animal { void eat () ; } //insert code here public class HouseCat extends Feline { public void eat() { } } 和五个申明 abstract class Feline implements Animal { } abstract class Feline implements Animal { void eat () ; } abstract class Feline implements Animal { public void eat();} abstract class Feline implements Animal { public void eat() {} } abstract class Feline implements Animal { abstract public void eat();} 结果为:()A
1B
2C
3D
4
考题
单选题现有: class TestApp{ public static void main (String[] args){ for (int i=0; i
A
0123B
012456789C
0123456789D
012
热门标签
最新试卷