<?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_080</id>
		<title>SCJP 1.6版考題 080 - 修訂歷史</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_080"/>
		<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_080&amp;action=history"/>
		<updated>2026-04-11T08:42:32Z</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_080&amp;diff=1340&amp;oldid=prev</id>
		<title>Ikk：新頁面:  3. interface Fish{}  4. class Perch implements Fish{}  5. class Walleye extends Perch{}  6. class Bluegill{}  7. public class Fisherman {  8.   public static void main(String[] args) ...</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_080&amp;diff=1340&amp;oldid=prev"/>
				<updated>2013-03-30T06:12:18Z</updated>
		
		<summary type="html">&lt;p&gt;新頁面:  3. interface Fish{}  4. class Perch implements Fish{}  5. class Walleye extends Perch{}  6. class Bluegill{}  7. public class Fisherman {  8.   public static void main(String[] args) ...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新頁面&lt;/b&gt;&lt;/p&gt;&lt;div&gt; 3. interface Fish{}&lt;br /&gt;
 4. class Perch implements Fish{}&lt;br /&gt;
 5. class Walleye extends Perch{}&lt;br /&gt;
 6. class Bluegill{}&lt;br /&gt;
 7. public class Fisherman {&lt;br /&gt;
 8.   public static void main(String[] args) {&lt;br /&gt;
 9.     Fish f = new Walleye();&lt;br /&gt;
 10.   Walleye w = new Walleye()&lt;br /&gt;
 11.   Bluegill b = new Bluegill();&lt;br /&gt;
 12.   if(f instanceof Perch) System.out.print(&amp;quot;f-p &amp;quot;);&lt;br /&gt;
 13.   if(w instanceof Fish) System.out.print(&amp;quot;w-f &amp;quot;);&lt;br /&gt;
 14.   if(b instanceof Fish) System.out.print(&amp;quot;b-f &amp;quot;);&lt;br /&gt;
 15. }&lt;br /&gt;
 16.}&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 What is the result?&lt;br /&gt;
   A. w-f&lt;br /&gt;
   B. f-p w-f&lt;br /&gt;
   C. w-f b-f&lt;br /&gt;
   D. f-p w-f b-f&lt;br /&gt;
   E. Compilation fails.&lt;br /&gt;
   F. An exception is thrown at runtime.&lt;br /&gt;
&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;
 f instanceof Perch是判斷f所指向的物件型態是否為Perch, &lt;br /&gt;
    f是指向Walleye物件，Walleye繼承Perch，所以12行if為true&lt;br /&gt;
 w instanceof Fish是true，w是指向Walleye物件，&lt;br /&gt;
    Walleye繼承Perch，Perch實作Fish，所以Walleye也是Fish的型態&lt;br /&gt;
 Bluegill類別與Fish沒有任何繼承關聯，所以b instanceof Fish為false&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>