This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Inheritance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Inheritance" Watch "Inheritance" New topic


Gaurav Pavan Kumar Jain
Ranch Hand

Joined: Mar 19, 2007
Posts: 168
class super {
2. public float getNum() {return 3.0f;}
3. )
5. public class Sub extends Super {
7. )
Which method, placed at line 6, will cause a compiler error?
A. Public float getNum() {return 4.0f; }
B. Public void getNum () { }
C. Public void getNum (double d) { }
D. Public double getNum (float d) {retrun 4.0f; }
Answer: B

cannot get the answer
dipayan chatterjee
Ranch Hand

Joined: Oct 03, 2007
Posts: 47
Hi gaurav

well this question is exactly the same as your previous query on inheritence only the wordings have changed,refer your previous query and try out this question once again, will get to know why B is correct. in case you fail i am there to help you

SCJP1.4 , gearing up for SCWCD 5
I agree. Here's the link:
subject: Inheritance
It's not a secret anymore!