How can I have toString() return a multi-line string?
问题 I'm working on a program that searches through an array and finds the smallest value and then prints out the time, firstName, and lastName of the runner. What I need to figure out is how to return the three values on separate lines, something like: public String toString() { return String.format( firstName + " " + lastName + " " + Time ); } That's what I have right now Is there a way to have the three values print out on separate lines? 回答1: Try This public String toString(){ return String