Page 1 of 1

About Question com.enthuware.ets.scjp.v6.2.295 :

Posted: Sat Jan 06, 2018 6:16 am
by TwistedLizard
I think the wording of the commentary for this question is inaccurate.

Code: Select all

class Outsider{
	public class Insider{ }
}
public class TestClass{
	public static void main(String[] args){
		Outsider os = new Outsider();
		// 1 insert line here
	}
}
The commentary for the 4th option

Code: Select all

Insider in = Outsider.new Insider();
says
Outsider.new Insider() is wrong as well because Insider is not static;
but that's not the reason this option is wrong. If Insider were static, the syntax would be

Code: Select all

Outsider.Insider in = new Outsider.Insider();

Re: About Question com.enthuware.ets.scjp.v6.2.295 :

Posted: Sat Jan 06, 2018 6:57 am
by admin
Actually, it is in connection with option 3, which is, "Outsider.Insider in = os.new Insider();" and the comment for this option "Since Insider is not a static class, it must have an associated outer class instance."

Option 4 replaces the variable os with class name Outsider, so the comment is talking about why replacing os with Outsider will not help.

Re: About Question com.enthuware.ets.scjp.v6.2.295 :

Posted: Sat Jan 06, 2018 7:20 am
by TwistedLizard
No big deal, but to me, the flow of that particular explanation seems hard to follow. Cheers.

Re: About Question com.enthuware.ets.scjp.v6.2.295 :

Posted: Sat Jan 06, 2018 9:45 am
by admin
OK, will improve.

thank you for your feedback!