Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Inheritance  RSS feed

 
Gaurav Pavan Kumar Jain
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class super {
2. public float getNum() {return 3.0f;}
3. )
4.
5. public class Sub extends Super {
6.
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
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!