Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #34046
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Why does Java argue about making a class instance |
| Date | 2016-03-28 14:59 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <ndbupe$kj1$1@dont-email.me> (permalink) |
| References | <nd6orl$k7m$1@reader1.panix.com> <1w52q64vhga89.szqfwweogyn3.dlg@40tude.net> <ndbb17$k7m$2@reader1.panix.com> |
On 3/28/2016 9:19 AM, Popping mad wrote:
> On Sat, 26 Mar 2016 21:01:58 +0100, Joerg Meier wrote:
>
>> In case you are unaware of what is happening: CollectVarsVisitor is a
>> non-static nested class, also called an "inner class". If you want to do
>> "new CollectVarsVisitor()", you need an instance of Main - you could do
>> "new Main().new CollectVarsVisitor()" (that would be solution b).
>
> why is that the case?
Because every instance of an inner class is associated with --
"belongs to" -- an instance of its containing class. That's what an
inner class *is*: An appendage, dependent, hanger-on, chattel, or
companion of its owner object.
> Because it is in the curly braces of Main, or because it is in the file
> itself?
Your question makes no sense, which leads me to suspect your
understanding of Java may as yet be inadequate for the tasks you
are trying to undertake. In other words: Back to the books!
--
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why does Java argue about making a class instance Popping mad <rainbow@colition.gov> - 2016-03-26 19:44 +0000
Re: Why does Java argue about making a class instance Joerg Meier <joergmmeier@arcor.de> - 2016-03-26 21:01 +0100
Re: Why does Java argue about making a class instance Popping mad <rainbow@colition.gov> - 2016-03-28 13:19 +0000
Re: Why does Java argue about making a class instance Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-03-28 14:59 -0400
Re: Why does Java argue about making a class instance Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-03-26 16:04 -0400
Re: Why does Java argue about making a class instance Popping mad <rainbow@colition.gov> - 2016-03-28 13:24 +0000
Re: Why does Java argue about making a class instance Arne Vajhøj <arne@vajhoej.dk> - 2016-03-28 09:50 -0400
Re: Why does Java argue about making a class instance Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-03-28 15:04 -0400
Re: Why does Java argue about making a class instance FredK <fred.l.kleinschmidt@gmail.com> - 2016-03-28 15:17 -0700
Re: Why does Java argue about making a class instance Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-03-28 18:30 -0400
Re: Why does Java argue about making a class instance Andreas Leitgeb <avl@logic.at> - 2016-03-26 20:17 +0000
Re: Why does Java argue about making a class instance Arne Vajhøj <arne@vajhoej.dk> - 2016-03-28 10:10 -0400
Re: Why does Java argue about making a class instance Roedy Green <inquiry@mindprod.com> - 2016-06-29 00:56 -0700
csiph-web