Path: csiph.com!feeder.erje.net!1.us.feeder.erje.net!news.linkpendium.com!news.linkpendium.com!panix!not-for-mail From: Popping mad Newsgroups: comp.lang.java.programmer Subject: Re: Why does Java argue about making a class instance Date: Mon, 28 Mar 2016 13:19:35 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 10 Message-ID: References: <1w52q64vhga89.szqfwweogyn3.dlg@40tude.net> NNTP-Posting-Host: www.mrbrklyn.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: reader1.panix.com 1459171175 20726 96.57.23.82 (28 Mar 2016 13:19:35 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Mon, 28 Mar 2016 13:19:35 +0000 (UTC) User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) Xref: csiph.com comp.lang.java.programmer:34036 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 it is in the curly braces of Main, or because it is in the file itself?