|
![]() |
I edited his code to add the missing code tags and also shortened the long lines (that is how you do it, but it will be much better if you shorten lines as you go). At least the second class wasn't as bad as the first one for long lines. I hope I don't have to edit it again and make it look differentCarey Brown wrote:Please edit your last post to put Code tags around the second block of code. . . . .
Every Object has a toString method. If it isn't an Object then it is null or a primitive, and you can print nulls and primitives, too. You should be able to pass absolutely anything to println and get some sort of output and no Exceptions.Carey Brown wrote:. . . System.out.println( user ); // ASSUMES User HAS A toString() METHOD
All things are lawful, but not all things are profitable.
I meant a useful toString() method.Campbell Ritchie wrote:
Every Object has a toString method. If it isn't an Object then it is null or a primitive, and you can print nulls and primitives, too. You should be able to pass absolutely anything to println and get some sort of output and no Exceptions.Carey Brown wrote:. . . System.out.println( user ); // ASSUMES User HAS A toString() METHOD
Carey Brown wrote:. . . I meant a useful toString() method.
That's a pleasureRain Draken wrote:Thank you for the advice . . .
Space pants. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|