试题详情
- 单项选择题 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.
- B
关注下方微信公众号,在线模考后查看
热门试题
- public class&e
- To implement&en
- 猴子吃桃问题:猴子第一天摘下若干个桃子,
- 用于生成Java文档的JDK工具是?()
- 一个数如果刚好与它所有的因子之和相等,则
- Your managemen
- 下列哪种异常是检查型异常,需要在编写程序
- 1. package&ens
- Which statemen
- class ThreadBo
- 一般来说,列表框中包括的项目数都多于它能
- class Test2{&e
- 现有: 1. &
- 下列哪个组件会产生Action事件?()
- public static void
- 已知: 在命令行中执行 javaCDE
- 下面关于try、catch和finall
- public class&e
- 11. public&ens
- public class&e