Click here to Skip to main content
15,891,136 members
Home / Discussions / Java
   

Java

 
QuestionNeed help with parameterized class or method Pin
David Crow13-Jan-09 7:36
David Crow13-Jan-09 7:36 
AnswerRe: Need help with parameterized class or method Pin
toxcct15-Jan-09 4:28
toxcct15-Jan-09 4:28 
GeneralRe: Need help with parameterized class or method Pin
David Crow15-Jan-09 4:51
David Crow15-Jan-09 4:51 
GeneralRe: Need help with parameterized class or method Pin
toxcct15-Jan-09 4:55
toxcct15-Jan-09 4:55 
QuestionRe: Need help with parameterized class or method Pin
David Crow15-Jan-09 5:01
David Crow15-Jan-09 5:01 
AnswerRe: Need help with parameterized class or method Pin
toxcct15-Jan-09 5:04
toxcct15-Jan-09 5:04 
GeneralRe: Need help with parameterized class or method Pin
David Crow15-Jan-09 5:16
David Crow15-Jan-09 5:16 
GeneralRe: Need help with parameterized class or method [modified] Pin
Naruki9-Feb-09 15:18
Naruki9-Feb-09 15:18 
Somewhere at home I have a wicked cool printing function that I tweaked from the original code, taken from an online article. I even got the author to suggest some improvements. Unfortunately, I'm at work and the whole thing is based on reflection.

What you seem to want is to override the toString() method.

By default, your objects will use Object.toString(), which merely prints out a hash code or some such. Not very useful for complex requirements.

Override it in your Fruit InfoBase class to print out whatever it is you want. Then, override it again in the subclasses only if you have special changes that the super class cannot see.

[Edited: just realized Fruit was not your class.]

If you want a one-size fits all solution, however, you'll definitely need reflection. If I remember to look tonight, I'll see if I can find that class.

Don't let my name fool you. That's my job.

modified on Monday, February 9, 2009 9:30 PM

Questionneed source code for our project Pin
Lakshmi4108712-Jan-09 4:33
Lakshmi4108712-Jan-09 4:33 
QuestionHello World Java Program Pin
prithaa11-Jan-09 6:10
prithaa11-Jan-09 6:10 
AnswerRe: Hello World Java Program Pin
tamour12-Jan-09 0:49
tamour12-Jan-09 0:49 
GeneralRe: Hello World Java Program Pin
prithaa15-Jan-09 18:06
prithaa15-Jan-09 18:06 
GeneralThe best starting point tutorial... Pin
Naruki9-Feb-09 15:01
Naruki9-Feb-09 15:01 
QuestionAm i converting the code right ? Pin
tamour9-Jan-09 11:49
tamour9-Jan-09 11:49 
GeneralRe: Am i converting the code right ? Pin
itsmani27-Jan-09 22:13
itsmani27-Jan-09 22:13 
QuestionCannot access database Pin
tamour9-Jan-09 3:19
tamour9-Jan-09 3:19 
QuestionDeveloping a discussion forum using java? Pin
avvisaan8-Jan-09 4:59
avvisaan8-Jan-09 4:59 
QuestionPort address Translation Pin
bobbo886-Jan-09 5:16
bobbo886-Jan-09 5:16 
QuestionHelp Please (java only please) Pin
bobbo886-Jan-09 3:40
bobbo886-Jan-09 3:40 
AnswerRe: Help Please (java only please) Pin
tamour9-Jan-09 11:56
tamour9-Jan-09 11:56 
GeneralRe: Help Please (java only please) Pin
bobbo8812-Jan-09 4:04
bobbo8812-Jan-09 4:04 
GeneralRe: Help Please (java only please) Pin
tamour13-Jan-09 18:01
tamour13-Jan-09 18:01 
QuestionTwo PrintStream objects for the same file Pin
DV_Dikla4-Jan-09 19:37
DV_Dikla4-Jan-09 19:37 
Questionhierarchical data in a true tree format Pin
Sambou52363-Jan-09 20:40
Sambou52363-Jan-09 20:40 
QuestionNetwork programming help!!!!!!! Pin
romance12-Jan-09 7:55
romance12-Jan-09 7:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.