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

题目内容 (请给出正确答案)
单选题
Assuming that the serializeBanana2() and the deserializeBanana2() methods will correctly use Java serialization and given:  import java.io.*;  class Food {Food() { System.out.print(”1”); } }  class Fruit extends Food implements Serializable {  Fruit() { System.out.print(”2”); } }  public class Banana2 extends Fruit { int size = 42;  public static void main(String [] args) {  Banana2 b = new Banana2();  b.serializeBanana2(b); // assume correct serialization  b = b.deserializeBanana2(b); // assume correct  System.out.println(” restored “+ b.size + “ “); }  // more Banana2 methods  }  What is the result?()
A

 Compilation fails.

B

 1 restored 42

C

 12 restored 42

D

 121 restored 42

E

 1212 restored 42

F

 An exception is thrown at runtime.


参考答案

参考解析
解析: 暂无解析
更多 “单选题Assuming that the serializeBanana2() and the deserializeBanana2() methods will correctly use Java serialization and given:  import java.io.*;  class Food {Food() { System.out.print(”1”); } }  class Fruit extends Food implements Serializable {  Fruit() { System.out.print(”2”); } }  public class Banana2 extends Fruit { int size = 42;  public static void main(String [] args) {  Banana2 b = new Banana2();  b.serializeBanana2(b); // assume correct serialization  b = b.deserializeBanana2(b); // assume correct  System.out.println(” restored “+ b.size + “ “); }  // more Banana2 methods  }  What is the result?()A  Compilation fails.B  1 restored 42C  12 restored 42D  121 restored 42E  1212 restored 42F  An exception is thrown at runtime.” 相关考题
考题 Eat some vegetables and fruit every day because they are (health) food.

考题 Among apple, Fuji apple, fruit and food, fruit is the basic level category and the rest are the subordinate categories.() 此题为判断题(对,错)。

考题 The word “leftovers” in Paragraph 1 probably means__________.A. food remaining after a mealB.things left undoneC.meals made of vegetablesD.pizza topped with fruit

考题 AssumingthattheserializeBanana2()andthedeserializeBanana2()methodswillcorrectlyuseJavaserializationandgiven:importjava.io.*;classFood{Food(){System.out.print(”1”);}}classFruitextendsFoodimplementsSerializable{Fruit(){System.out.print(”2”);}}publicclassBanana2extendsFruit{intsize=42;publicstaticvoidmain(String[]args){Banana2b=newBanana2();b.serializeBanana2(b);//assumecorrectserializationb=b.deserializeBanana2(b);//assumecorrectSystem.out.println(”restored+b.size+);}//moreBanana2methods}Whatistheresult?()

考题 Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo()method, which two statements are true?() A.The class implements java.lang.Comparable.B.The class implements java.util.Comparator.C.The interface used to implement sorting allows this class to define only one sort sequence.D.The interface used to implement sorting allows this class to define many different sort sequences.

考题 下列哪个选项的java源文件代码片段是不正确的?A.package testpackage; public class Test{ }B.import java. io. *; package testpaekage; public class Test { }C.import java.io.*; class Person { } public class Test { }D.import java.io.*; import java. awt.*; public class Test{ }

考题 下列( )选项的java源文件代码片段是不正确的。A.package testpackage; publicClass Test{}B.import java.io.*; package testpackage: publicClass Test{}C.import java.io.*; Class Person{} publicClass Test{}D.import java.io.*; import java.awt.*; publicClass Test{}

考题 下列代码的输出结果是( )。class parent{void printme(){System.out.println("parent");}}class child extends parent{void printme(){System. out.println("child");}void printall(){super, printme();this.printme();printme();}}public class test{public static void main(String args[]){child myc=new child();myc.printall();}}A.import java.awt.*;B.import java.applet.applet;C.import java.io.*;D.import java, awt.graphics;

考题 下列哪个选项的java源文件程序段是不正确的? ( )A.package testpackage; public class Test{ }B.import java.io.*; package testpackage; public class Test{ }C.import java.i.*; class Person{} public class Test{ }D.import java.io.*; import java.awt.*; public class Test { }

考题 共用题干 Drying Ways for Food1.Centuries ago,man discovered that removing moisture from food helps to preserve it,and that the easiest way to do this is to expose the food to sun and wind.In this way the North American Indians produce pemmican(dried meat ground into powder and made into cakes),the Scandinavians make stockfish and the Arabs dried dates and"apricot leather".2.All foods including water,cabbage and other leaf vegetables contain as much as 93%water, potatoes and other root vegetables 80%,lean meat 75%and fish,anything from 20%to 60%,depending on how fatty it is.If this water is removed,the activity of the bacteria which causes food to go bad is checked.3.Fruit is sun-dried in Asia Minor,Greece,Spain and other Mediterranean countries,and also in California,South Africa and Australia. The methods used vary, but in general,the fruit is spread out on trays in drying yards in the hot sun.In order to prevent darkening,pears,peaches and apricots are exposed to the fumes of burning sulfur before drying. Plums,for making prunes, and certain varieties of grapes for making raisins and currants,are dipped in an alkaline solution in order to crack the skins of the fruit slightly and remove their wax coating,so as to increase the rate of drying.4.Nowadays most foods are dried mechanically.The conventional method of such dehydration is to put food in chambers through which hot air is blown at temperatures of about 110℃at entry and to about 43℃at exit. This is the usual method for drying such things as vegetables,minced meat, and fish.5.Liquids such as milk,coffee,tea,soups and eggs may be dried by pouring them over a heated steel cylinder,by spraying them into a chamber through which a current of hot air passes.In the first case,the dried material is scraped off the roller as a thin film which is then broken up into small,though still relatively coarse flakes.In the second process,it falls to the bottom of the chamber as a fine powder. Where recognizable pieces of meat and vegetables are required,as in soup, the ingredients are dried separately and then mixed.6.Dried foods take up less room and weigh less than the same food packed in cans or frozen, and they do not need to be stored in special conditions.For these reasons they are invaluable to the climbers,explorers and soldiers in battle,who have little storage space.They are also popular with housewives because it takes so little time to cook them.Usually it is just a case of replacing the dried-out moisture with boiling water.Paragraph 4______A:Drying Fruit in the Traditional Way.B:Food Drying Histrory.C:Water in Food.D:Drying of Liquid Food.E:Advantages of Dry Food.F: Mechanical Food Dehydration.

考题 Given a file GrizzlyBear.java:  1. package animals.mammals;  2.  3. public class GrizzlyBear extends Bear {  4. void hunt() {  5. Salmon s = findSalmon();  6. s.consume();  7. }  8. }  and another file, Salmon.java:  1. package animals.fish; 2.  3. public class Salmon extends Fish {  4. void consume() { /* do stuff */ }  5. }  Assume both classes are defined in the correct directories for theft packages, and that the Mammal class correctly defines the findSalmon() method. Which two changes allow this code to compile correctly?()A、 add public to the start of line 4 in Salmon.javaB、 add public to the start of line 4 in GrizzlyBear.javaC、 add import animals.mammals.*; at line 2 in Salmon.javaD、 add import animals.fish.*; at line 2 in GrizzlyBear.javaE、 add import animals.fish.Salmon.*; at line 2 in GrizzlyBear.javaF、 add import animals.mammals.GrizzlyBear.*;at line 2 in Salmon.java

考题 interface Data { public void load(); }  abstract class Info { public abstract void load(); }  Which class correctly uses the Data interface and Info class?() A、 public class Employee extends Info implements Data { public void load() { /*do something*/ } }B、 public class Employee implements Info extends Data { public void load() { /*do something*/ } }C、 public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }D、 public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }E、 public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }F、 public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }

考题 Assuming that the serializeBanana2() and the deserializeBanana2() methods will correctly use Java serialization and given:  import java.io.*;  class Food {Food() { System.out.print(”1”); } }  class Fruit extends Food implements Serializable {  Fruit() { System.out.print(”2”); } }  public class Banana2 extends Fruit { int size = 42;  public static void main(String [] args) {  Banana2 b = new Banana2();  b.serializeBanana2(b); // assume correct serialization  b = b.deserializeBanana2(b); // assume correct  System.out.println(” restored “+ b.size + “ “); }  // more Banana2 methods  }  What is the result?() A、 Compilation fails.B、 1 restored 42C、 12 restored 42D、 121 restored 42E、 1212 restored 42F、 An exception is thrown at runtime.

考题 现自:  1.  interface Color {  }      2. interface Weight  {  }      3.  //insert code here    和以下足六个声明:  class Boat extends Color, extends Weight  {  }     class Boat extends Color and Weight  {  }      class Boat extends Color, Weight  {  }  class Boat implements Color,  implements Weight  {  }     class Boat implements Color and Weight  {  }      class Boat implements Color, Weight  {  }    分别插入到第3行,有多少行可以编译? () A、  0B、  1C、  2D、  3

考题 GivenafileGrizzlyBear.java: 1.package animals.mammals; 2. 3.public class GrizzlyBear extends Bear{ 4.voidhunt(){ 5.Salmons=findSalmon(); 6.s.consume(); 7.} 8.} and another file,Salmon.java: 1.packageanimals.fish; 2. 3.public class Salmon extends Fish{ 4.voidconsume(){/*dostuff*/} 5.} Assume both classes are defined in the correct directories for theft packages,and that the Mammal class correctly defines the findSalmon()method.Which two changes allow this code to compile correctly?()A、add public to the start of line 4 in Salmon.javaB、add public to the start of line 4 in GrizzlyBear.javaC、add import animals.mammals.*;at line 2 in Salmon.javaD、add import animals.fish.*at line 2 in GrizzlyBear.javaE、add import animals.fish.Salmon.*;at line 2 in GrizzlyBear.javaF、add import animals.mammals.GrizzlyBear.*;at line 2 in Salmon.java

考题 Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo() method, which two statements are true?()A、The class implements java.lang.Comparable.B、The class implements java.util.Comparator.C、The interface used to implement sorting allows this class to define only one sort sequence.D、The interface used to implement sorting allows this class to define many different sort sequences.

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

考题 Assuming that the serializeBanana() and the deserializeBanana() methods will correctly use Java serialization and given:  import java.io.*;  class Food implemertts Serializable {int good = 3;}  class Fruit externds Food {int juice = 5;}  public class Banana extends Fruit {  int yellow = 4;  public static void main(String [] args) {  Banana b = new Banana(); Banana b2 = new Banana();  b.serializeBanana(b); // assume correct serialization  b2 = b.deserializeBanana(); // assume correct  System.out.println(”restore “+b2.yellow+ b2.juice+b2.good);  }  // more Banana methods go here  }  What is the result?() A、 restore 400B、 restore 403C、 restore 453D、 Compilation fails.E、 An exception is thrown at runtime.

考题 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.

考题 public abstract class Shape {  private int x;  private int y;  public abstract void draw();  public void setAnchor(int x, int y) {  this.x = x;  this.y = y;  }  }  Which two classes use the Shape class correctly?()A、 public class Circle implements Shape { private int radius; }B、 public abstract class Circle extends Shape { private int radius; }C、 public class Circle extends Shape { private int radius; public void draw(); }D、 public abstract class Circle implements Shape { private int radius; public void draw(); }E、 public class Circle extends Shape { private int radius;public void draw() {/* code here */} }F、 public abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }

考题 单选题141- Conversation 1 What does the man want? A A free ticket to the lecture.B Information about the lunch meeting.C Favorite food and fruit.

考题 单选题Assuming that the serializeBanana2() and the deserializeBanana2() methods will correctly use Java serialization and given:  import java.io.*;  class Food {Food() { System.out.print(”1”); } }  class Fruit extends Food implements Serializable {  Fruit() { System.out.print(”2”); } }  public class Banana2 extends Fruit { int size = 42;  public static void main(String [] args) {  Banana2 b = new Banana2();  b.serializeBanana2(b); // assume correct serialization  b = b.deserializeBanana2(b); // assume correct  System.out.println(” restored “+ b.size + “ “); }  // more Banana2 methods  }  What is the result?()A  Compilation fails.B  1 restored 42C  12 restored 42D  121 restored 42E  1212 restored 42F  An exception is thrown at runtime.

考题 单选题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 Color {  }      2. interface Weight  {  }      3.  //insert code here    和以下足六个声明:  class Boat extends Color, extends Weight  {  }     class Boat extends Color and Weight  {  }      class Boat extends Color, Weight  {  }  class Boat implements Color,  implements Weight  {  }     class Boat implements Color and Weight  {  }      class Boat implements Color, Weight  {  }    分别插入到第3行,有多少行可以编译? ()A   0B   1C   2D   3

考题 单选题Assuming that the serializeBanana() and the deserializeBanana() methods will correctly use Java serialization and given:  import java.io.*;  class Food implemertts Serializable {int good = 3;}  class Fruit externds Food {int juice = 5;}  public class Banana extends Fruit {  int yellow = 4;  public static void main(String [] args) {  Banana b = new Banana(); Banana b2 = new Banana();  b.serializeBanana(b); // assume correct serialization  b2 = b.deserializeBanana(); // assume correct  System.out.println(”restore “+b2.yellow+ b2.juice+b2.good);  }  // more Banana methods go here  }  What is the result?()A  restore 400B  restore 403C  restore 453D  Compilation fails.E  An exception is thrown at runtime.

考题 单选题interface Data { public void load(); }  abstract class Info { public abstract void load(); }  Which class correctly uses the Data interface and Info class?()A  public class Employee extends Info implements Data { public void load() { /*do something*/ } }B  public class Employee implements Info extends Data { public void load() { /*do something*/ } }C  public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }D  public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }E  public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }F  public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*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

考题 单选题Which is the best one for preserving food in the following methods?A Put the food in a cold place.B Cook the food well.C Dry the food by sun.D It is not told.