The one thing we do know is that there isn't an instruction to print the address in that method.
Mike Simmons wrote:. . . Or could it be a print statement inserted into the method itself? . . .
Mike Simmons wrote:We also "know" that the method builds the address with a ":" rather than a "-". And yet, we're willing to speculate on what the authors meant to write. Or what the OP may have miscopied. I don't think any of this is definite at this point - for all I know, the question in the book might actually have a print statement, which the OP misremembered as a return statement. Or not.
Assuming the question was copied directly, and therefore needs revision anyway... I do think that the question would be better if the ambiguity about what is "output" (print or return value) were removed. Replacing the return with a print statement would make things clearer in that sense, if a correction is required.
So it is. Back to the errata page!
Piet Souris wrote:. . . the possible output should be split over 2 lines.
Mike Simmons wrote:Depending once again on what the original question in the book really says. I know the actual exam used to routinely use System.out.print() rather than println() for questions like this, precisely to make it easier to show the output on one line. Don't know if that was done in the book or not.
Mike Simmons wrote:Thanks, Jeanne. Here I don't think the concern is about the final line break (or lack thereof) - but whether there should be a line break between the "Posted:" and the address. If println is used, there should be one -but the answer shown here (this thread) is
If that's what the book says, time for another errata. Possibly for "New Yok" as well. ;) . Without the book handy, it's hard for us to know. Cheers...
It runs on an internal combustion engine. This ad does not:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton