• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Abstract class question  RSS feed

 
anton mcarthy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an exam question about an abstract class, my class called Employee is abstract and has a float abstract method called calculateMonthlyPay,
i then have another two classes that extend Employee class but the calculateMonthlyPay is not a float in those two its a double,
I'm just wondering if the exam paper is wrong or am i.

i have attached the question image.

question.jpg
[Thumbnail for question.jpg]
 
Joe Bishara
Ranch Hand
Posts: 175
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exam question is wrong. Covariant return types in overriding methods apply to reference types, not primitive types.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!