<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Vincent6's Weblog</title>
	<atom:link href="http://vincent6.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://vincent6.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Tue, 15 Jan 2008 10:02:37 +0000</lastBuildDate>
	<language>zh-tw</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='vincent6.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Vincent6's Weblog</title>
		<link>http://vincent6.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://vincent6.wordpress.com/osd.xml" title="Vincent6&#039;s Weblog" />
	<atom:link rel='hub' href='http://vincent6.wordpress.com/?pushpress=hub'/>
		<item>
		<title>instanceof test</title>
		<link>http://vincent6.wordpress.com/2008/01/15/instanceof-test/</link>
		<comments>http://vincent6.wordpress.com/2008/01/15/instanceof-test/#comments</comments>
		<pubDate>Tue, 15 Jan 2008 09:47:38 +0000</pubDate>
		<dc:creator>vincent6</dc:creator>
				<category><![CDATA[未分類]]></category>

		<guid isPermaLink="false">http://vincent6.wordpress.com/2008/01/15/instanceof-test/</guid>
		<description><![CDATA[package PracticalJava; interface Employee {   public int salary(); } class Manager implements Employee {   private static final int mgrSal = 40000;   public int salary () {   return mgrSal;   } }class Programmer implements Employee {   private static final int prgSal = 50000;   private static final int prgBonus = 10000; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vincent6.wordpress.com&amp;blog=2516091&amp;post=5&amp;subd=vincent6&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><code>package PracticalJava;</code></p>
<p><code></code><code>interface Employee {<br />
  public int salary();<br />
}</code><code> </code><code>class Manager implements Employee {<br />
  private static final int mgrSal = 40000;<br />
  public int salary () {<br />
  return mgrSal;<br />
  }<br />
}</code><code>class Programmer implements Employee {<br />
  private static final int prgSal = 50000;<br />
  private static final int prgBonus = 10000;<br />
  public int salary() {<br />
  return prgSal;<br />
  }<br />
  public int bonus () {<br />
  return prgBonus;<br />
  }<br />
}</p>
<p>public class Payroll {</p>
<p>public int calcPayroll (Employee emp) {<br />
  int money = emp.salary();<br />
  if (emp instanceof Programmer)<br />
  money += ((Programmer)emp).bonus(); //Calculate the bonus<br />
  return money;<br />
  }</p>
<p>public static void main(String[] args) {<br />
  Payroll pr = new Payroll();<br />
  Programmer prg = new Programmer();<br />
  Manager mgr = new Manager();<br />
  System.out.println("Payroll for Programmer is "+pr.calcPayroll(prg));<br />
  System.out.println("Payroll for Manager is "+pr.calcPayroll(mgr));</p>
<p>}</p>
<p>}</p>
<p>這個寫法還有改善的機會,運用多型的方式評估到底適不適合用 instanceof.</p>
<p></code></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vincent6.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vincent6.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vincent6.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vincent6.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vincent6.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vincent6.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vincent6.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vincent6.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vincent6.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vincent6.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vincent6.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vincent6.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vincent6.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vincent6.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vincent6.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vincent6.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vincent6.wordpress.com&amp;blog=2516091&amp;post=5&amp;subd=vincent6&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vincent6.wordpress.com/2008/01/15/instanceof-test/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/888d0239089d59ad9558b63906170374?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vincent6</media:title>
		</media:content>
	</item>
		<item>
		<title>Stack Test &#8211; Object reference question.</title>
		<link>http://vincent6.wordpress.com/2008/01/14/stack-test-object-reference-question/</link>
		<comments>http://vincent6.wordpress.com/2008/01/14/stack-test-object-reference-question/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 09:07:21 +0000</pubDate>
		<dc:creator>vincent6</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://vincent6.wordpress.com/2008/01/14/stack-test-object-reference-question/</guid>
		<description><![CDATA[import java.util.EmptyStackException; public class Stack {     private Object[] elements;     private int size = 0;         public Stack(int initialCapacity) {         this.elements = new Object[initialCapacity];     }         public void push(Object e) {         ensureCapacity();         elements[size++] = e;     }         public Object pop() {         if (size == 0) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vincent6.wordpress.com&amp;blog=2516091&amp;post=4&amp;subd=vincent6&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>import java.util.EmptyStackException;</p>
<p>public class Stack {</p>
<p>    private Object[] elements;<br />
    private int size = 0;<br />
   <br />
    public Stack(int initialCapacity) {<br />
        this.elements = new Object[initialCapacity];<br />
    }<br />
   <br />
    public void push(Object e) {<br />
        ensureCapacity();<br />
        elements[size++] = e;<br />
    }<br />
   <br />
    public Object pop() {<br />
        if (size == 0)<br />
            throw new EmptyStackException();<br />
       <br />
        Object result = elements[--size];<br />
        elements[size] = null;<br />
        return result;<br />
        <font color="#ff0000"><strike>//return elements[--size]; </strike>此行寫法將無法 release object reference.</font><br />
    }<br />
   <br />
    /**<br />
     * Ensure space for at least one more element, roughly<br />
     * doubling the capacity each time the array needs to grow.<br />
     */<br />
    private void ensureCapacity() {<br />
        if (elements.length == size) {<br />
            Object[] oldElements = elements;<br />
            elements = new Object[2 * elements.length + 1];<br />
            System.arraycopy(oldElements, 0, elements, 0, size);<br />
        }<br />
    }<br />
   <br />
    /**<br />
     * @param args<br />
     */<br />
    public static void main(String[] args) {<br />
        Stack stack = new Stack(10);<br />
        stack.push(new Object());<br />
        System.out.println(stack.pop());<br />
        //System.out.println(stack.pop());<br />
    }</p>
<p>}</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vincent6.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vincent6.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vincent6.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vincent6.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vincent6.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vincent6.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vincent6.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vincent6.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vincent6.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vincent6.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vincent6.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vincent6.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vincent6.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vincent6.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vincent6.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vincent6.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vincent6.wordpress.com&amp;blog=2516091&amp;post=4&amp;subd=vincent6&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vincent6.wordpress.com/2008/01/14/stack-test-object-reference-question/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/888d0239089d59ad9558b63906170374?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vincent6</media:title>
		</media:content>
	</item>
		<item>
		<title>第一個Blog! let&#8217;s blogging!!</title>
		<link>http://vincent6.wordpress.com/2008/01/14/%e7%ac%ac%e4%b8%80%e5%80%8bblog-lets-blogging/</link>
		<comments>http://vincent6.wordpress.com/2008/01/14/%e7%ac%ac%e4%b8%80%e5%80%8bblog-lets-blogging/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 07:28:38 +0000</pubDate>
		<dc:creator>vincent6</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://vincent6.wordpress.com/2008/01/14/%e7%ac%ac%e4%b8%80%e5%80%8bblog-lets-blogging/</guid>
		<description><![CDATA[Yes!!!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vincent6.wordpress.com&amp;blog=2516091&amp;post=3&amp;subd=vincent6&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Yes!!!</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vincent6.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vincent6.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vincent6.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vincent6.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vincent6.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vincent6.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vincent6.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vincent6.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vincent6.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vincent6.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vincent6.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vincent6.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vincent6.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vincent6.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vincent6.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vincent6.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vincent6.wordpress.com&amp;blog=2516091&amp;post=3&amp;subd=vincent6&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vincent6.wordpress.com/2008/01/14/%e7%ac%ac%e4%b8%80%e5%80%8bblog-lets-blogging/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/888d0239089d59ad9558b63906170374?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vincent6</media:title>
		</media:content>
	</item>
	</channel>
</rss>
