Ciro Vilchez wrote:and the listAll method must return a MeetingGroup object. However, it must print a string with info from attributes from the class. Anyone knows how can I return a String as a class object?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ciro Vilchez wrote:MeetingGroups is the class, and the listAll method must return a MeetingGroup object. However, it must print a string with info from attributes from the class. Anyone knows how can I return a String as a class object?
Ciro Vilchez wrote:
I can't use the toString() method because it complains I'm returning a String.
Ciro Vilchez wrote:Hi, thanks for the replies. I probably haven't explained very well. Let's say I have the below line in the Main class:
...
With the println() method, it will call by default the toString() method in MeetingGroup, so if I don't override it it will just print the name of the class MeetingGroup, but I want it to print just the attribute "someOutput". Can someone help on this?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ciro Vilchez wrote:Yes I know I need to override the toString() method in the MeetingGroup class. The problem is, I don't know how to do it so it returns the desired output, I have nothing in my notes to do that.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ciro Vilchez wrote:
Yes I know I need to override the toString() method in the MeetingGroup class. The problem is, I don't know how to do it so it returns the desired output, I have nothing in my notes to do that.
Consider Paul's rocket mass heater. |