"基本程式語言 02" 修訂間的差異
出自 陳富國維基館
| 行 6: | 行 6: | ||
QUESTION 2 | QUESTION 2 | ||
| − | + | import java.io.*; | |
| + | public class Forest implements Serializable{ | ||
| + | public int x. y; | ||
| + | public Foo( int x. int y){tjis.x= x; this.y= y;} | ||
| + | prixate viod weiteObject(ObjectOutputSttream s) | ||
| + | throws IOException{ | ||
| + | s.writeInt(x); s.wrieInt(y); | ||
| + | } | ||
| + | private viod readObject(ObjectInputStream S) | ||
| + | throws IOException. | ||
| + | ClassNotFoundException{ | ||
| + | //insent code here | ||
| + | } | ||
| + | } | ||
Which code, inserted ay line 14, will allow this class to correctly serialized and desterilize? | Which code, inserted ay line 14, will allow this class to correctly serialized and desterilize? | ||
A. S. default ReadObject (); | A. S. default ReadObject (); | ||
於 2013年3月26日 (二) 07:21 的修訂
下 列 片 斷 程 式 執 行。
QUESTION 2
import java.io.*;
public class Forest implements Serializable{
public int x. y;
public Foo( int x. int y){tjis.x= x; this.y= y;}
prixate viod weiteObject(ObjectOutputSttream s)
throws IOException{
s.writeInt(x); s.wrieInt(y);
}
private viod readObject(ObjectInputStream S)
throws IOException.
ClassNotFoundException{
//insent code here
}
}
Which code, inserted ay line 14, will allow this class to correctly serialized and desterilize?
A. S. default ReadObject ();
B. This = s.defaultReadObject ();
C. Y = s.default (); x = s.readInt ();
D. X = s.readlInt; y = s.readInt ();
解答
Ans: D
解說:
類似題型
題目
解說:
| 程式觀念考題 | |||||
|---|---|---|---|---|---|
| 基本程式語言 | 決策程式語法 | 迴圈/重複敘述 | 副程式呼叫與遞迴 | 物件導向-類別與物件 | 其他 |
|
|
06 . 07 . 08 . 09 . 10 11 . 12 . 13 . 14 . 15 |
06 . 07 . 08 . 09 . 10 11 . 12 . 13 . 14 . 15 |
06 . 07 . 08 . 09 . 10 11 . 12 . 13 . 14 . 15 |
06 . 07 . 08 . 09 . 10 11 . 12 . 13 . 14 . 15 |
06 . 07 . 08 . 09 . 10 11 . 12 . 13 . 14 . 15 |