<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-TW">
		<id>https://fgchen.com/wiki/index.php?action=history&amp;feed=atom&amp;title=SCJP_1.6%E7%89%88%E8%80%83%E9%A1%8C_148</id>
		<title>SCJP 1.6版考題 148 - 修訂歷史</title>
		<link rel="self" type="application/atom+xml" href="https://fgchen.com/wiki/index.php?action=history&amp;feed=atom&amp;title=SCJP_1.6%E7%89%88%E8%80%83%E9%A1%8C_148"/>
		<link rel="alternate" type="text/html" href="https://fgchen.com/wiki/index.php?title=SCJP_1.6%E7%89%88%E8%80%83%E9%A1%8C_148&amp;action=history"/>
		<updated>2026-04-24T09:43:00Z</updated>
		<subtitle>本 Wiki 上此頁面的修訂歷史</subtitle>
		<generator>MediaWiki 1.29.0</generator>

	<entry>
		<id>https://fgchen.com/wiki/index.php?title=SCJP_1.6%E7%89%88%E8%80%83%E9%A1%8C_148&amp;diff=1271&amp;oldid=prev</id>
		<title>Ikk：新頁面:  Given:  12. import java.io.*;  13. public class Forest implements Serializable{  14.   private Tree tree = new Tree();  15.   public static void main(String[] args){  16.     Forest f...</title>
		<link rel="alternate" type="text/html" href="https://fgchen.com/wiki/index.php?title=SCJP_1.6%E7%89%88%E8%80%83%E9%A1%8C_148&amp;diff=1271&amp;oldid=prev"/>
				<updated>2013-03-30T03:03:02Z</updated>
		
		<summary type="html">&lt;p&gt;新頁面:  Given:  12. import java.io.*;  13. public class Forest implements Serializable{  14.   private Tree tree = new Tree();  15.   public static void main(String[] args){  16.     Forest f...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新頁面&lt;/b&gt;&lt;/p&gt;&lt;div&gt; Given:&lt;br /&gt;
 12. import java.io.*;&lt;br /&gt;
 13. public class Forest implements Serializable{&lt;br /&gt;
 14.   private Tree tree = new Tree();&lt;br /&gt;
 15.   public static void main(String[] args){&lt;br /&gt;
 16.     Forest f = new Forest();&lt;br /&gt;
 17.   try{&lt;br /&gt;
 18.   FileOutputStream fs = new FileOutputStream(&amp;quot;Forest.ser&amp;quot;);&lt;br /&gt;
 19.   ObjectOutputStream os = new ObjectOutputStream(fs);&lt;br /&gt;
 20.   os.writeObject(f); os.close();&lt;br /&gt;
 21.   }catch(Exception ex){ex.printStackTrace();}&lt;br /&gt;
 22. }}&lt;br /&gt;
 23.&lt;br /&gt;
 24. class Tree{}&lt;br /&gt;
&lt;br /&gt;
 What is the result?&lt;br /&gt;
  A. Compilation fails.&lt;br /&gt;
  B. An exception is thrown at runtime.&lt;br /&gt;
  C. An instance of Forest is serialized.&lt;br /&gt;
  D. An instance of Forest and an instance of Tree are both serialized.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:medium;&amp;quot;&amp;gt;解答&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size: medium;&amp;quot;&amp;gt;Ans: B   &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:medium;&amp;quot;&amp;gt; 解說:&lt;br /&gt;
 Forest物件所擁有的物件Tree也同樣要宣告實作Serializable，&lt;br /&gt;
 這樣整個包含關係的物件才能正確使用Java的serializable機制&lt;br /&gt;
 24. class Tree implements Serializable{}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/span&amp;gt;	&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
{{SCJP 1.6版考題講解}}&lt;/div&gt;</summary>
		<author><name>Ikk</name></author>	</entry>

	</feed>