Page 1 of 1

About Question enthuware.ocpjp.v11.2.3503

Posted: Thu Aug 29, 2024 3:42 am
by asherjackson
public class TestOuter { public static class TestInner {
public void sayIt(){ System.out.println("hello"); } }
public static void main(String[] args){
//call here
} }

Why TestInner.sayIt(); cannot be the the second answer?

Re: About Question enthuware.ocpjp.v11.2.3503

Posted: Thu Aug 29, 2024 6:32 am
by admin
The explanation below this option says,
TestInner is static but its method sayIt is not. So, you need to do new TestInner().sayIt(); in main to invoke sayIt."
Seems quite clear. Please let us know which part is causing confusion so that additional explanation can be provided.