0

Can anyone check what mistake i did?i cant understand…

https://code.sololearn.com/c05K8eBWGWdc/?ref=app

27th Aug 2017, 4:38 PM
li wai lim
li wai lim - avatar
3 Réponses
+ 2
@Restoring faith is correct that the reason there is no output is due to your toString method not properly overriding. However, it is possible to still overload the toString method as well. When done the overloaded toString method must be explicitly called though. If you created another method exactly like the one you already have minus the parameters it will work when passing your time object to the println method. Then if you wanted to use the other toString method you would call it on the time object like: time.toString("12", "15", "30")
27th Aug 2017, 5:18 PM
ChaoticDawg
ChaoticDawg - avatar
+ 4
toString() cannot have any parameters. There's no overloading for printing objects. I assume that's what the issue is atleast. (no errors, so i don't really know if that's what you're confused about)
27th Aug 2017, 4:43 PM
Rrestoring faith
Rrestoring faith - avatar
0
Tq
27th Aug 2017, 4:49 PM
li wai lim
li wai lim - avatar