<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Instantiating Java inner-class objects, from a different class.</title>
	<atom:link href="http://virtualinfinity.net/wordpress/java/esoteric-java-features/2007/01/09/6/feed/" rel="self" type="application/rss+xml" />
	<link>http://virtualinfinity.net/wordpress/java/esoteric-java-features/2007/01/09/6/</link>
	<description>Daniel Pitts' Tech Blog</description>
	<pubDate>Sat, 22 Nov 2008 03:30:18 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
		<item>
		<title>By: New Adventures in Software &#187; More Stupid Java Tricks</title>
		<link>http://virtualinfinity.net/wordpress/java/esoteric-java-features/2007/01/09/6/#comment-217</link>
		<dc:creator>New Adventures in Software &#187; More Stupid Java Tricks</dc:creator>
		<pubDate>Tue, 26 Aug 2008 19:00:32 +0000</pubDate>
		<guid isPermaLink="false">http://virtualinfinity.net/wordpress/?p=6#comment-217</guid>
		<description>[...] but they don&#8217;t necessarily have to be instantiated within the scope of the parent class.  Daniel Pitts shows another way.  File this one under &#8220;ugly syntax&#8221; and &#8220;surely that&#8217;s not supposed to [...]</description>
		<content:encoded><![CDATA[<p>[...] but they don&#8217;t necessarily have to be instantiated within the scope of the parent class.  Daniel Pitts shows another way.  File this one under &#8220;ugly syntax&#8221; and &#8220;surely that&#8217;s not supposed to [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://virtualinfinity.net/wordpress/java/esoteric-java-features/2007/01/09/6/#comment-62</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Fri, 07 Dec 2007 15:29:27 +0000</pubDate>
		<guid isPermaLink="false">http://virtualinfinity.net/wordpress/?p=6#comment-62</guid>
		<description>I think you can edit comments if you're logged in when you comment.  Also, you can use &#60;pre class="code"&gt; to denote code snippets on this site :-).

Thanks for the comment.</description>
		<content:encoded><![CDATA[<p>I think you can edit comments if you&#8217;re logged in when you comment.  Also, you can use &lt;pre class=&#8221;code&#8221;> to denote code snippets on this site :-).</p>
<p>Thanks for the comment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Piotr Kobzda</title>
		<link>http://virtualinfinity.net/wordpress/java/esoteric-java-features/2007/01/09/6/#comment-61</link>
		<dc:creator>Piotr Kobzda</dc:creator>
		<pubDate>Fri, 07 Dec 2007 14:45:02 +0000</pubDate>
		<guid isPermaLink="false">http://virtualinfinity.net/wordpress/?p=6#comment-61</guid>
		<description>Daniel, in my previous comment submission here, I used a &#60;code&#62; tag around my example, but it doesn't looks so nice rendered on a page.  So, my message needs some formatting (maybe also my English correction?) before publishing (of course, if you think it's worth of that...).  Possibly adding a &#60;pre&#62; tag around the code is enough... but I'm sure you can correct it the better way... :)
Also, now I think that my example could be a bit nicer with all occurrences of "outer" replaced with "get" -- of course, it works without that change as well. :-)

TIA for correcting me! :-))

BTW, it would be a nice feature of your web-site, to be able to correct/remove own postings before your acceptation.

P.S. This message is not an article comment, and you can freely remove it.

P.S.2 Nice site! :-)</description>
		<content:encoded><![CDATA[<p>Daniel, in my previous comment submission here, I used a &lt;code&gt; tag around my example, but it doesn&#8217;t looks so nice rendered on a page.  So, my message needs some formatting (maybe also my English correction?) before publishing (of course, if you think it&#8217;s worth of that&#8230;).  Possibly adding a &lt;pre&gt; tag around the code is enough&#8230; but I&#8217;m sure you can correct it the better way&#8230; <img src='http://virtualinfinity.net/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Also, now I think that my example could be a bit nicer with all occurrences of &#8220;outer&#8221; replaced with &#8220;get&#8221; &#8212; of course, it works without that change as well. <img src='http://virtualinfinity.net/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>TIA for correcting me! :-))</p>
<p>BTW, it would be a nice feature of your web-site, to be able to correct/remove own postings before your acceptation.</p>
<p>P.S. This message is not an article comment, and you can freely remove it.</p>
<p>P.S.2 Nice site! <img src='http://virtualinfinity.net/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Piotr Kobzda</title>
		<link>http://virtualinfinity.net/wordpress/java/esoteric-java-features/2007/01/09/6/#comment-60</link>
		<dc:creator>Piotr Kobzda</dc:creator>
		<pubDate>Fri, 07 Dec 2007 12:07:16 +0000</pubDate>
		<guid isPermaLink="false">http://virtualinfinity.net/wordpress/?p=6#comment-60</guid>
		<description>Other, not obvious IMHO, but also interesting (and even more "esoteric" I think) feature of Java, is an ability of a single instance of inner class to have multiple (and different!) enclosing class' instances.

An example:

&lt;pre class="code"&gt;
class EnclosingInstancesTest {
  public static void main(String... _) {
     A a = new A();
     A.I ai = a.new I();
     assert(ai.outerA()==a);

     B b = new B();
     B.I bi1 = b.new I();
     assert(bi1.outerA()==b &#38;&#38; bi1.outerB()==b);
     B.I bi2 = b.new I(a);
     assert(bi2.outerA()==a &#38;&#38; bi2.outerB()==b);
  }
}

class A {
  class I {
    A outerA() { return A.this; }
  }
}

class B extends A {
  class I extends A.I {
    I() { }
    I(A a) { a.super(); }
    B outerB() { return B.this; }
  }
}
&lt;/pre&gt;

I don't really know any important usage of that feature, but I hope it's worth to know about it.</description>
		<content:encoded><![CDATA[<p>Other, not obvious IMHO, but also interesting (and even more &#8220;esoteric&#8221; I think) feature of Java, is an ability of a single instance of inner class to have multiple (and different!) enclosing class&#8217; instances.</p>
<p>An example:</p>
<pre class="code">
class EnclosingInstancesTest {
  public static void main(String... _) {
     A a = new A();
     A.I ai = a.new I();
     assert(ai.outerA()==a);

     B b = new B();
     B.I bi1 = b.new I();
     assert(bi1.outerA()==b &amp;&amp; bi1.outerB()==b);
     B.I bi2 = b.new I(a);
     assert(bi2.outerA()==a &amp;&amp; bi2.outerB()==b);
  }
}

class A {
  class I {
    A outerA() { return A.this; }
  }
}

class B extends A {
  class I extends A.I {
    I() { }
    I(A a) { a.super(); }
    B outerB() { return B.this; }
  }
}
</pre>
<p>I don&#8217;t really know any important usage of that feature, but I hope it&#8217;s worth to know about it.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
