文档详情

《java面试笔试题(English)》.pdf

发布:2016-01-06约字共页下载文档
文本预览下载声明
Exam : 310-055 Title : Sun Certified Programmer for the Java 2 Platform, Standard Edition 5.0 Ver : 01-07-08 310-055 QUESTION 1: Given the code in the exhibit. What is the result? A. Compilation fails B. An exception is thrown at runtime. C. An instance of Forest is serialized. D. An instance of Forest and an instance of Tree are both serialized. Answer: B Explanation: The following code can be tested: 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 exp){exp.printStackTrace();} }} class Tree{} QUESTION 2: A - The Power of Knowing 310-055 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. readInt; y = s. readInt ( ); Answer: D QUESTION 3: Given the exhibit. What is the result? A. 0 B. 1 C. 4 D. Compilation fails E. An exception is thrown at runtime Answer: D A - The Power of Knowing 310-055 QUESTION 4: Given the exhibit: The variable df is an object of type DateFormat that has been initialized in line 11. What is the result if this code is run on December 14,2000? A. The value of S is 14 - dic-2004 B. The value of S is Dec 14, 2000 C. An exception is thrown at runtime D. Compilation fails because of an error in line 13. Answer: D QUESTION 5: DRAG DROP The doesFileExist method takes an array of directo
显示全部
相似文档