Page 1 of 1

About Question enthuware.ocpjp.v8.2.1327 :

Posted: Sun Sep 04, 2016 9:25 am
by ramy6_1
Hello ,

Can we consider class C as static class since it is declared inside static method main ?
If that is right so why new TestClass.C(); doesn't work - although new TestClass.B(); working fine?

Kindly clarify.

Re: About Question enthuware.ocpjp.v8.2.1327 :

Posted: Sun Sep 04, 2016 11:01 am
by admin
You cannot do new TestClass.C() because C is not a member of TestClass. B is.

Re: About Question enthuware.ocpjp.v8.2.1327 :

Posted: Thu Feb 20, 2020 11:13 am
by bvrulez
Wow, preparing for OCP I had to google the basic concept that static members of a class are not inherited by a subclass and can therefore not be referenced by with an instance of the subclass...