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.
About Question enthuware.ocpjp.v8.2.1327 :
Moderator: admin
-
- Posts: 124
- Joined: Wed Feb 12, 2014 2:44 am
- Contact:
-
- Site Admin
- Posts: 10036
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1327 :
You cannot do new TestClass.C() because C is not a member of TestClass. B is.
If you like our products and services, please help us by posting your review here.
-
- Posts: 33
- Joined: Sat Feb 15, 2020 12:44 am
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1327 :
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...
Who is online
Users browsing this forum: marpiva and 29 guests