单选题现有:  class Pet implements Serializable  {      Collar c= new Collar();      }  class Collar implements Serializable  {      collarPart cpl=new CollarPart ("handle");      CollarPart cp2=new CollarPart ("clip");      }     class CollarPart implements Serializable()  如果Pet实例被序列化,则多少对象将被序列化?()A0B1C2D3E4F5

单选题
现有:  class Pet implements Serializable  {      Collar c= new Collar();      }  class Collar implements Serializable  {      collarPart cpl=new CollarPart ("handle");      CollarPart cp2=new CollarPart ("clip");      }     class CollarPart implements Serializable()  如果Pet实例被序列化,则多少对象将被序列化?()
A

0

B

1

C

2

D

3

E

4

F

5


参考解析

解析: 暂无解析

相关考题:

如下程序的输出结果是______。 include using namespace std; class Pet{ char nam 如下程序的输出结果是______。include<iostream>using namespace std;class Pet{char name[10];public:Pet(char*nanle){strcpy(this->name,name);}const char*getName( )const{return name;}virtual void call( )eonst=0;};class Dog:public Pet{public:Dog(char*name):Pet(name){ }void call( )eonst{cout<<"汪汪叫";}};class Cat:public Pet{public:Cat(char*name):Pet(name){ }void call( )const{eout<<"喵喵叫";}};int main( ){Pet*petl=new Dog("哈克"),*pet2=new Cat("吉米");eout<<petl->getName( );petl->call( );eout<<endl;cout<<pet2->getName( );pet2->call( );eout<<endl;return 0;}

下列关于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,B,以下描述中表示B继承自A的是 ( )A.class A extends BB.class B implements AC.class A implements BD.class B extends A

有如下程序: include using namespace std; class Pet{ char name[10]; public: Pet(c 有如下程序:include<iostream>using namespace std;class Pet{char name[10];public:Pet(char*name){strcpy(this->name,name);}const char*getName()const {return name;}virtual void call()const=0;};class Dog:public Pet{public:Dog(char*name):Pet(name){}void call()const{cout<<"汪汪叫":}};class Cat:public Pet{public:Cat(char*name):Pet(name){}void call()const{cout<<"喵喵叫";}};int main(){Pet*pet1=new Dog("哈克"),*pet2=new Cat("吉米");cout<<pet1->getName();pet1->call();cout<<end1;cout<<pet2->getName();pet2->call();cout<<end1;return 0;}程序的输出结果是______。

interface A{int x = 0;}class B{int x =1;}class C extends B implements A {public void pX(){System.out.println(x);}public static void main(String[] args) {new C().pX();}}

下列关于Test类的定义中,正确的是( )。A.class Test implements Runnable{ public void run{} Dublic void someMethod[]{} }B.class Test implements Runnable( puIblic void run; }C.class Test implements Runnable( Dublic void someMethod[]; }D.class Test implements Runnable( public void someMethod{} }

public class Pet{}  public class Cat extends Pet{}   执行代码   Cat c = new Cat();   Pet p = (Pet)c;   下列哪项是正确的? A、Pet p = (Pet)c正常执行B、Pet p = (Pet)c编译错误C、Pet p = (Pet)c运行错误D、以上都不对

现自:  class Car implements Serializable  ()      class Ford extends Car  {}  如果试图序列化一个Ford实例,结果为()  A、编译失败B、两个对象被序列化C、—个对象被序列化D、运行时异常被抛出

现有: public class Pet( ) public class Cat extends Pet{) 执行代码 Cat c- new Cat( ); Pet p= (Pet)c; 后下列哪项是正确的?()A、Petp=(Pet)c运行错误B、Petp=(Pet)c编译错误C、Petp=(Pet)c止常执行D、以上都不对

interface Animal {  void soundOff();  }  class Elephant implements Animal {  public void soundOff() {  System.out.println(“Trumpet”);  }  }  class Lion implements Animal {  public void soundOff() { System.out.println(“Roar”);  }  }  class Alpha1 {  static Animal get( String choice ) {  if ( choice.equalsIgnoreCase( “meat eater” )) {  return new Lion();  } else {  return new Elephant();  }  }  }  Which compiles?()  A、 new Animal().soundOff();B、 Elephant e = new Alpha1();C、 Lion 1 = Alpha.get(“meat eater”);D、 new Alpha1().get(“veggie”).soundOff();

现有:   class Thread2 implements Runnable {   void run() {   System.out.print("go ");   }   public static void main(String [] args) {   Thread2 t2 = new Thread2();   Thread t = new Thread(t2);   t.start();   }   }   结果为:()A、 goB、 编译失败C、 代码运行,无输出结果D、 运行时异常被抛出

现有:   public class Pet()  public class Cat extends Pet{)      执行代码  Cat c- new Cat();      Pet p=  (Pet)c;  后下列哪项是正确的?()    A、 Pet p=(Pet)c运行错误B、 Pet p=(Pet)c编译错误C、 Pet p= (Pet)c止常执行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*/}    }

现有:  class Pet implements Serializable  {      Collar c= new Collar();      }  class Collar implements Serializable  {      collarPart cpl=new CollarPart ("handle");      CollarPart cp2=new CollarPart ("clip");      }     class CollarPart implements Serializable()  如果Pet实例被序列化,则多少对象将被序列化?()    A、0B、1C、2D、3E、4F、5

public class Pet{  public void speak(){   System.out.print(“ Pet ”);  }  }   public class Cat extends Pet{  public void speak(){   System.out.print(“ Cat ”);  }  }   public class Dog extends Pet{  public void speak(){   System.out.print(“ Dog ”);  }  }   执行代码   Pet[] p = {new Cat(),new Dog(),new Pet()};   for(int i=0;i〈p.length;i++)   p[i].speak();   后输出的内容是哪项?()  A、Pet Pet PetB、Cat Cat CatC、Cat Dog PetD、Cat Dog Dog

现有:  class ThreadBoth extends Threaa implements Runnable  {      public void run()  (System.out.print("hi");  }     public static voicl main (String  []  args)  {     Thread tl=new ThreadBoth():      Thread t2 = new Thread (tl):     tl.run():      t2.run():     }          结果为:()      A、 hi hiB、 hiC、编译失败D、运行时异常被抛出

import java.io.*;  public class Forest implements Serializable {  private Tree tree = new Tree();  public static void main(String [] args) {  Forest f= new Forest();  try {  FileOutputStream fs = new FileOutputStream(”Forest.ser”);  ObjectOutputStream os = new ObjectOutputStream(fs);  os.writeObject(f); os.close();  } catch (Exception ex) { ex.printStackTrace(); }  }  }  class Tree { }  What is the result?() A、 Compilation fails.B、 An exception is thrown at runtime.C、 An instance of Forest is serialized.D、 A instance of Forest and an instance of Tree are both serialized.

You work as the application developer at Hi-Tech.com. You create a new custom dictionary named MyDictionary. Choose the code segment which will ensure that MyDictionary is type safe?()A、 Class MyDictionary Implements Dictionary (Of String,String)B、 Class MyDictionary Inherits HashTableC、 Class MyDictionary Implements IDictionaryD、 Class MyDictionary End Class Dim t as New Dictionary (Of String, String) Dim dict As MyDIctionary= CType (t,MyDictionary)

单选题现有:   public class Pet()  public class Cat extends Pet{)      执行代码  Cat c- new Cat();      Pet p=  (Pet)c;  后下列哪项是正确的?()A Pet p=(Pet)c运行错误B Pet p=(Pet)c编译错误C Pet p= (Pet)c止常执行D以上都不对

单选题现有: public class Pet( ) public class Cat extends Pet{) 执行代码 Cat c- new Cat( ); Pet p= (Pet)c; 后下列哪项是正确的?()APetp=(Pet)c运行错误BPetp=(Pet)c编译错误CPetp=(Pet)c止常执行D以上都不对

单选题public class Pet{  public void speak(){   System.out.print(“ Pet ”);  }  }   public class Cat extends Pet{  public void speak(){   System.out.print(“ Cat ”);  }  }   public class Dog extends Pet{  public void speak(){   System.out.print(“ Dog ”);  }  }   执行代码   Pet[] p = {new Cat(),new Dog(),new Pet()};   for(int i=0;i〈p.length;i++)   p[i].speak();   后输出的内容是哪项?()APet Pet PetBCat Cat CatCCat Dog PetDCat Dog Dog

单选题public class Pet{}  public class Cat extends Pet{}   执行代码   Cat c = new Cat();   Pet p = (Pet)c;   下列哪项是正确的?APet p = (Pet)c正常执行BPet p = (Pet)c编译错误CPet p = (Pet)c运行错误D以上都不对

单选题You work as the application developer at Hi-Tech.com. You create a new custom dictionary named MyDictionary. Choose the code segment which will ensure that MyDictionary is type safe?()A Class MyDictionary Implements Dictionary (Of String,String)B Class MyDictionary Inherits HashTableC Class MyDictionary Implements IDictionaryD Class MyDictionary End Class Dim t as New Dictionary (Of String, String) Dim dict As MyDIctionary= CType (t,MyDictionary)

单选题import java.io.*;  public class Forest implements Serializable {  private Tree tree = new Tree();  public static void main(String [] args) {  Forest f= new Forest();  try {  FileOutputStream fs = new FileOutputStream(”Forest.ser”);  ObjectOutputStream os = new ObjectOutputStream(fs);  os.writeObject(f); os.close();  } catch (Exception ex) { ex.printStackTrace(); }  }  }  class Tree { }  What is the result?()A Compilation fails.B An exception is thrown at runtime.C An instance of Forest is serialized.D A instance of Forest and an instance of Tree are both serialized.

单选题现有:  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行,有几个可以通过编译?()A0B1C2D3

单选题现自:  class Car implements Serializable  ()      class Ford extends Car  {}  如果试图序列化一个Ford实例,结果为()A编译失败B两个对象被序列化C—个对象被序列化D运行时异常被抛出

单选题interface Animal {  void soundOff();  }  class Elephant implements Animal {  public void soundOff() {  System.out.println(“Trumpet”);  }  }  class Lion implements Animal {  public void soundOff() { System.out.println(“Roar”);  }  }  class Alpha1 {  static Animal get( String choice ) {  if ( choice.equalsIgnoreCase( “meat eater” )) {  return new Lion();  } else {  return new Elephant();  }  }  }  Which compiles?()A new Animal().soundOff();B Elephant e = new Alpha1();C Lion 1 = Alpha.get(“meat eater”);D new Alpha1().get(“veggie”).soundOff();

单选题现有:  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();} 结果为:()A1B2C3D4