This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android 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
Similar Threads
overriding in java
why does this not compile?
overriding / overloading
Override method
why does it throws compilation error in the subclass?