About Question enthuware.ocpjp.v8.2.1327 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
ramy6_1
Posts: 124
Joined: Wed Feb 12, 2014 2:44 am
Contact:

About Question enthuware.ocpjp.v8.2.1327 :

Post 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.

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

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.

bvrulez
Posts: 33
Joined: Sat Feb 15, 2020 12:44 am
Contact:

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

Post 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...

Post Reply

Who is online

Users browsing this forum: marpiva and 29 guests