<?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_083</id>
		<title>SCJP 1.6版考題 083 - 修訂歷史</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_083"/>
		<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_083&amp;action=history"/>
		<updated>2026-05-13T23:15:06Z</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_083&amp;diff=1337&amp;oldid=prev</id>
		<title>Ikk：新頁面:  10. interface Foo{  11.   int bar();  12. }  13.  14. public class Beta {  15.  16. class A implements Foo{  17.   public int bar(){return 1;}  18. }  19.  20. public int fubar(Foo fo...</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_083&amp;diff=1337&amp;oldid=prev"/>
				<updated>2013-03-30T06:08:13Z</updated>
		
		<summary type="html">&lt;p&gt;新頁面:  10. interface Foo{  11.   int bar();  12. }  13.  14. public class Beta {  15.  16. class A implements Foo{  17.   public int bar(){return 1;}  18. }  19.  20. public int fubar(Foo fo...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新頁面&lt;/b&gt;&lt;/p&gt;&lt;div&gt; 10. interface Foo{&lt;br /&gt;
 11.   int bar();&lt;br /&gt;
 12. }&lt;br /&gt;
 13.&lt;br /&gt;
 14. public class Beta {&lt;br /&gt;
 15.&lt;br /&gt;
 16. class A implements Foo{&lt;br /&gt;
 17.   public int bar(){return 1;}&lt;br /&gt;
 18. }&lt;br /&gt;
 19.&lt;br /&gt;
 20. public int fubar(Foo foo){return foo.bar();}&lt;br /&gt;
 21.&lt;br /&gt;
 22. public void testFoo(){&lt;br /&gt;
 23.&lt;br /&gt;
 24. class A implements Foo{&lt;br /&gt;
 25.   public int bar() {return 2;}&lt;br /&gt;
 26. }&lt;br /&gt;
  &lt;br /&gt;
 27.&lt;br /&gt;
 28. System.out.println(fubar(new A()));&lt;br /&gt;
 29. }&lt;br /&gt;
 30.&lt;br /&gt;
 31. public static void main(String[] argv){&lt;br /&gt;
 32.   new Beta().testFoo();&lt;br /&gt;
 33. }&lt;br /&gt;
 34. }&lt;br /&gt;
  &lt;br /&gt;
 &lt;br /&gt;
 Which three statements are true? (Choose three.)&lt;br /&gt;
   A. Compilation fails.&lt;br /&gt;
   B. The code compiles and the output is 2.&lt;br /&gt;
   C. If lines 16, 17 and 18 were removed, compilation would fail.&lt;br /&gt;
   D. If lines 24, 25 and 26 were removed, compilation would fail.&lt;br /&gt;
   E. If lines 16, 17 and 18 were removed, the code would compile and the output would be 2.&lt;br /&gt;
   F. If lines 24, 25 and 26 were removed, the code would compile and the output would be 1.&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 E F    &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;
 28行new A()，A類別是testFoo方法中定義的，所以回傳出2&lt;br /&gt;
 若24~26移除，則使用的A類別是16~18定義的，回傳1&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>