网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

以public修饰的类如:public class Car{…} 则Car()

  • A、可被其它程序包中的类使用
  • B、仅能被本程序包中的类使用
  • C、不能被任意其它类使用
  • D、不能被其它类继承

参考答案

更多 “以public修饰的类如:public class Car{…} 则Car()A、可被其它程序包中的类使用B、仅能被本程序包中的类使用C、不能被任意其它类使用D、不能被其它类继承” 相关考题
考题 下面是关于派生类声明的开始部分,其中正确的是A.class virtual B:public AB.virtual class B:public AC.class B:public A virtualD.class B:virtual public A

考题 下列哪个类声明是正确的? ( )A.abstract final class H1 {...}B.abstract private move(){...}C.protected private numberD.public abstract class Car{...}

考题 请将下列类定义补充完整。class Base{public:void fun(){tout<<"Base::fun"<<endl;}};class Derived:public Base{public:void fun(){______//显示调用基类的fun函数cout<<"Derived::fun"<<endl;};

考题 下列虚基类的声明中正确的是( )。A.class virtual B:public AB.virtual class B:public AC.class B:public A virtualD.class B:virtual public A

考题 下列是关于派生类声明的开始部分,其中正确的是( )。A.class virtual B:public AB.virtual class B:public AC.class B:public A virtualD.class B:virtualpublicA

考题 下列关于Test类的定义中,正确的是______。A) class Test implements Runnabte{public void run(){}public void someMethod(){}B) class Test implements Rnuuable{public void run();}C) class Test implements Rnuuable{public void someMethod();}D) class Test implements Rnuuable{public void someMethod();{}}A.B.C.D.

考题 下列哪个方法可用于创建一个可运行的类? ( )A.public class X implements Runable {public void run(){...,.,}}B.public class X implements Thread {public void run(){......}}C.public class X implements Thread {public int run(){……}}D.public class X implements Runable {protected void run(){.....}}

考题 在如下源代码文件Test.java中, 哪个是正确的类定义?() A.public class test { public int x = 0; public test(int x) { this.x = x; } }B.public class Test{ public int x=0; public Test(int x) { this.x = x; } }C.public class Test extends T1, T2 { public int x = 0; public Test (int x) { this.x = x; } }D.public class

考题 阅读下列说明、图和Java代码,将应填入(n)处的字句写在对应栏内。【说明】已知对某载客车辆(Car)进行类建模,如图7-1所示,其中类Engine表示发动机引擎,类Wheel表示车轮,类Body表示车身,类Driver表示司机,类Passenger表示乘客。【Java代码】class Body{ //此处代码省略 ); //车身类class Passenger{ //此处代码省略 )/ //乘客类class Wheel{ //此处代码省略 ); //车轮类class Driver{ //司机类public String name; //表示第几路公交车司机public Driver(String driverName){name = driverName/) //构造函数};class Engine{//引擎类public String engineNo;//引擎编号public Engine(String engineNo){this.engineNo=engineNo;)//构造函数};public class Car{//汽车类static final int(1)=7; //定义最多载客数static final int MAX WHEELS =5; //定义最多轮胎数protected Engine engine;protected Driver driver;protected Body body=new Body();protected Wheel[] wheels;protected Passenger[]passengers;public Car(Driver driver){ //构造函数(2).driver=driver;engine=new Engine("TX6536型号引擎");wheels=new Wheel[MAX WHEELS];passengers=new Passenger[MAX_PASSENGERS];for(int index=0;index<MAX_WHEELS;index++){wheels[index]=new Wheel();}for(int index=0;index<MAX_PASSENGERS;index++){passengers[index]=null;}}int getPassengerNumber(){//获取车上乘客数量//此处代码省略}void getOnPassenger(Passenger aPassenger){//乘客上车//此处代码省略}void run(){ //开车if((3)){System.out.println("司机尚未上车!");return;}//此处代码省略}public static void main(String args[]){Driver driver=new Driver("第五路公交车司机");Car car=new Car((4));for (int index = 0 ; index < MAX_PASSENGERS; index ++)car.getOnPassenger((5) Passenger());car.run();}}

考题 若已定义了类Vehicle,则下列派生类定义中,错误的是A.class Car:Vehicle{/*类体略*/);B.class Car:public Car{/*类体略*/);C.class Car:public Vehicle{/*类体略*/);D.class Car:virtual public Vehicle{/*类体略*/);

考题 下列虚基类的声明中,正确的是( )。A.class virtualB:public AB.virtual classB:public AC.class B:public A virtualD.class B:virtual public A

考题 下列对类的声明,正确的是A.abstract final class Hh{…}B.abstract private move(){…}C.protected private number;D.public abstract class Car{…}

考题 下列对类的声明,正确的是( ) BA.abstract final class Hh{…}B.abstract private move(){…}C.protected private number;D.public abstract class Car{…}

考题 阅读下列说明、图和Java代码,填补空缺。[说明]已知对某载客车辆(Car)进行类建模,如图13-2所示,其中类Engine表示发动机引擎,类Wheel表示车轮,类Body表示车身,类Driver表示司机,类Passenger表示乘客。[Java代码]class Body{ //此处代码省略 }; //车身类class Passenger{ //此处代码省略 }; //乘客类class Wheel{ //此处代码省略 }; //车轮类class Driver{ //司机类public String name; //表示第几路公交车司机public Driver(String driverName){name=driverName; }//构造函数};class Engine{ //引擎类public String engineNo; //引擎编号public Engine(String engineNo){this.engineNo=engineNo; }//构造函数};public class Car{ //汽车类static final int (1) =7; //定义最多载客数static final int MAX_WHEELS=5; //定义最多轮胎数protected Engine engine;protected Driver driver;protected Body body=new Body( );protected Wheel[]wheels;protected Passenger[]passengers;public Car(Driver driver){ //构造函数(2) .driver=driver;engine=new Engine("TX6536型号引擎");wheels = new Wheel[MAX_WHEELS];passengers=new Passenger[MAX_PASSENGERS];for(int index=0; index<MAX_WHEELS; index++){wheels[index]=new Wheel( );}for(int index=0; index<MAX_PASSENGERS; index++){passengers[index]=null;}}int getPassengerNumber( ){ //获取车上乘客数量//此处代码省略}void getOnPassenger(Passenger aPassenger ){//乘客上车//此处代码省略}void run( ){ //开车if( (3) )(System.out.printin("司机尚未上车!"); return; }//此处代码省略}public static void main(String args[]){Driver driver=new Driver("第五路公交车司机");Car car=new Car( (4) );for(int index=0; index <MAX_PASSENGERS; index++)car.getOnPassenger( (5) Passenger( ));car.run( );}}

考题 试题七(共 15 分)阅读下列说明、图和Java代码,将应填入 (n) 处的字句写在答题纸的对应栏内。[说明]已知对某载客车辆(Car)进行类建模,如图 7-1所示,其中类 Engine 表示发动机引擎,类 Wheel 表示车轮,类 Body 表示车身,类 Driver 表示司机,类 Passenger 表示乘客。[Java 代码]class Body{ //此处代码省略 }; //车身类class Passenger{ //此处代码省略 }; //乘客类class Wheel{ //此处代码省略 }; //车轮类class Driver{ //司机类public String name; //表示第几路公交车司机public Driver(String driverName){name = driverName;} //构造函数};class Engine{ //引擎类public String engineNo; //引擎编号public Engine(String engineNo){ this.engineNo = engineNo; } //构造函数};public class Car{ //汽车类static final int (1) = 7; //定义最多载客数static final int MAX_WHEELS = 5; //定义最多轮胎数protected Engine engine;protected Driver driver;protected Body body = new Body();protected Wheel[] wheels;protected Passenger[] passengers;public Car(Driver driver){ //构造函数(2) .driver = driver;engine = new Engine("TX6536 型号引擎");wheels = new Wheel[MAX_WHEELS];passengers = new Passenger[MAX_PASSENGERS];for (int index = 0; index MAX_WHEELS; index++){wheels[index] = new Wheel();}for (int index = 0; index MAX_PASSENGERS; index++){passengers[index] = null;}}int getPassengerNumber(){ //获取车上乘客数量//此处代码省略}void getOnPassenger(Passenger aPassenger ){ //乘客上车//此处代码省略}void run(){ //开车if( (3) ){ System.out.println("司机尚未上车!"); return;}//此处代码省略}public static void main(String args[]){Driver driver = new Driver("第五路公交车司机");Car car = new Car( (4) );for (int index = 0 ; index MAX_PASSENGERS; index ++)car.getOnPassenger( (5) Passenger());car.run();}}

考题 阅读下列说明和Java代码,将应填入(n)处的字句写在答题纸的对应栏内。【说明】某软件公司欲开发一款汽车竞速类游戏,需要模拟长轮胎和短轮胎急刹车时在路面上留 下的不同痕迹,并考虑后续能模拟更多种轮胎急刹车时的痕迹。现采用策略(Strategy)设计模式来实现该需求,所设计的类图如图 5-1 所示。 【Java代码】import java.util.*; interface BrakeBehavior{public (1) ;/*其余代码省略*/}class LongWheelBrake implements BrakeBehavior{public void stop(){System.out.println("模拟长轮胎刹车痕迹! ");}/*其余代码省略*/}class ShortWheelBrake implements BrakeBehavior {public void stop(){System.out.println("模拟短轮胎刹车痕迹! ");}/*其余代码省略 */}abstract class Car{protected (2) wheel;public void brake(){ (3) ;}/*其余代码省略*/}class ShortWheelCar extends Car {public ShortWheelCar(BrakeBehavior behavior){(4) ; } /*其余代码省略*/}class StrategyTest{public static void main(String[]args){BrakeBehaviorbrake =new ShortWheelBrake();ShortWheelCar car1= new ShortWheelCar(brake);car1. (5) ;}}

考题 public class TestA{    public void methodA() throws IOException{        //……    } }  public class TestB extends TestA{    public void methodA() throws EOFException{        //……   } }  public class TestC extends TestA{    public void methodA() throws Exception{        //……   } }  当编译类TestC的时候,结果是哪项?() A、 正常B、 编译错误C、 运行错误D、 以上都不对

考题 Which three demonstrate an “is a” relationship?() A、 public class X { }  public class Y extends X { }B、 public interface Shape { }  public interface Rectangle extends Shape{ }C、 public interface Color { }  public class Shape { private Color color; }D、 public interface Species { }  public class Animal { private Species species; }E、 public class Person { } public class Employee {  public Employee(Person person) { }F、 interface Component { }  class Container implements Component { private Component[] children; }

考题 Which two allow the class Thing to be instantiated using new Thing()?A、 public class Thing { }B、 public class Thing { public Thing() {} }C、 public class Thing { public Thing(void) {} }D、 public class Thing { public Thing(String s) {} }E、 public class Thing { public void Thing() {} public Thing(String s) {} }

考题 下列哪个类的声明是正确的()A、abstract final class HI{}B、abstract private move(){}C、protected private number;D、public abstract class Car{}

考题 下列哪个类声明是正确的()。A、abstract final class H1{…}B、abstract private move(){…}C、protected private number;D、public abstract class Car{…}

考题 下面哪一个是正确的类的声明?()A、public void HH{…}B、public class Move(){…}C、public class void number{}D、public class Car{…}

考题 在C#程序中,如果类B要继承类A,类B正确的定义为()。A、public class B inherit AB、public class B :: AC、public class B : AD、public class B from A

考题 现有:  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*/}    }

考题 单选题11. abstract class Vehicle { public int speed() { return 0; } }  12. class Car extends Vehicle { public int speed() { return 60; } }  13. class RaceCar extends Car { public int speed() { return 150; }}  ......  21. RaceCar racer = new RaceCar();  22. Car car = new RaceCar();  23. Vehicle vehicle = new RaceCar();  24. System.out.println(racer.speed() + “, „ + car.speed()  25. + “, “+ vehicle.speed());  What is the result?()A  0, 0,0B  150, 60, 0C  Compilation fails.D  150, 150, 150E  An exception is thrown at runtime.

考题 多选题public class Car {  private int wheelCount;  private String vin;  public Car(String vin) {  this.vin = vin;  this.wheelCount = 4;  }  public String drive() {  return “zoom-zoom”;  }  public String getInfo() {  return “VIN: “+ vin + “wheels: “+ wheelCount;  }  }  And:  public class MeGo extends Car {  public MeGo(String vin) {  this.wheelCount = 3;  }  }  What two must the programmer do to correct the compilation errors?()Ainsert a call to this() in the Car constructorBinsert a call to this() in the MeGo constructorCinsert a call to super() in the MeGo constructorDinsert a call to super(vin) in the MeGo constructorEchange the wheelCount variable in Car to protectedFchange line 3 in the MeGo class to super.wheelCount = 3;

考题 单选题以public修饰的类如:public class Car{…} 则Car()A 可被其它程序包中的类使用B 仅能被本程序包中的类使用C 不能被任意其它类使用D 不能被其它类继承