• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock Question

 
Higgledy Smith
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a question from the K&B SCJP Study Guide 6.0 1st mock exam.

What is the point of this question? Are the test makers trying to test constructors or access modifiers?


Given:

 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15480
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Higgledy Smith wrote:This is a question from a mock exam.

Which mock exam? Please note that we require you to quote your sources, and just saying "a mock exam" is not good enough.
 
Higgledy Smith
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper Young wrote:
Higgledy Smith wrote:This is a question from a mock exam.

Which mock exam? Please note that we require you to quote your sources, and just saying "a mock exam" is not good enough.


Fixed. Sorry.
 
Ruben Soto
Ranch Hand
Posts: 1032
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Higgledy Smith wrote:This is a question from the K&B SCJP Study Guide 6.0 1st mock exam.

What is the point of this question? Are the test makers trying to test constructors or access modifiers?

What's the question, again? I only saw some code. From looking at it, I guess the point is that if the constructor in the superclass had been private then the code wouldn't compile.
 
Welly Tambunan
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Higgledy Smith wrote:This is a question from the K&B SCJP Study Guide 6.0 1st mock exam.

What is the point of this question? Are the test makers trying to test constructors or access modifiers?


Given:


Based on my opinion. That's trying to test both.
Imagine if the class both resides in the different package.
That would be compile error.
Because constructor in superclass cannot be accessed outside its package.

is that right?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic