• Post Reply Bookmark Topic Watch Topic
  • New Topic

Inheritance question  RSS feed

 
James Nobles
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The output of my code is displaying the location of the index in the console. For instance :

The highest score is: chap10coursegrades.PassFailExam@1dd7056

How do I get it to display the highest grade in the array?
Thanks

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does your PassFailExam.java also overrides the toString method?

Please have a look at http://www.coderanch.com/how-to/java/HowToAskQuestionsOnJavaRanch Typing Question instead of Q in your post title will not take you ages!
 
James Nobles
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not entirely sure what you mean. Here is my passFailExam.java class :

 
Paweł Baczyński
Bartender
Posts: 2086
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So your PassFailExam does not override toString() method. What about GradedActivity?
 
James Nobles
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Negative.
 
Paweł Baczyński
Bartender
Posts: 2086
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, if you want your object to be displayed with some useful info, you need to override toString() method.
Have some reading
link 1
link 2
link 3
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!