单选题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() 

题目
单选题
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.

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

The word “leftovers” in Paragraph 1 probably means__________.

A. food remaining after a meal

B.things left undone

C.meals made of vegetables

D.pizza topped with fruit


正确答案:A

第2题:

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.


参考答案:A, C

第3题:

Eat some vegetables and fruit every day because they are (health) food.


正确答案:
42. healthy

第4题:

下列哪个选项的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 { }


正确答案:B

第5题:

下列( )选项的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{}


正确答案:B

第6题:

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);//assumecorrectserialization

b=b.deserializeBanana2(b);//assumecorrect

System.out.println(”restored+b.size+);}

//moreBanana2methods

}

Whatistheresult?()


参考答案:D

第7题:

下列哪个选项的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{ }


正确答案:B
解析:Java中的package语句必须是源文件中除去说明以外的第一条语句,导入包语句可以有几个,但是必须位于package语句之后,其他类定义之前,一个源文件中可以有几个类,但最多只能有一个是public的,如果有,则源文件的文件名必须和该类的类名相同。

第8题:

Among apple, Fuji apple, fruit and food, fruit is the basic level category and the rest are the subordinate categories.()

此题为判断题(对,错)。


参考答案:错误

第9题:

下列代码的输出结果是( )。

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;


正确答案:A

第10题:

共用题干
Drying Ways for Food

1.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.

答案:F
解析:
本题考查的是对所读材料大意与主旨的掌握。由本段首句可知,本段中,心意思是所有的食物都含有水分。
本题考查的是对所读材料大意与主旨的掌握。本段中心意思是传统的水果干制方法。
本题考查的是对所读材料大意与主旨的掌握。本段中心意思是用机器干制食物的方法。
本题考查的是对所读材料大意与主旨的掌握。本段中心意思是干燥流质食物的方法。
本题考查的是对阐述文章的主旨事实与细节的了解。依据是第二段的第二句“If this water is removed , the activity of the bacteria which causes food to go bad is checked."
本题考查的是对阐述文章的主旨事实与细节的了解。依据是第三段的第一句“Fruit is sun-dried in Asia Minor , Greece , Spain and other Mediterranean countries , and also in California,South Africa and Australia."
本题考查的是对阐述文章的主旨事实与细节的了解。依据是第三段的第四句“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."
本题考查的是对阐述文章的主旨事实与细节的了解。依据是第五段的第二句“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."

更多相关问题