0

Any help will be greatly appreciated

I have this piece of code and am getting an error that "the constructor of class Travel cannot be applied to given types"..any idea how I might solve this and why the error is showing would be greatly appreciated... Here's my code...iam still a beginner.. https://code.sololearn.com/c4dOIY2i3o2Y/?ref=app

4th Dec 2019, 11:58 AM
Allan And Lifted Hands
Allan And Lifted Hands - avatar
4 ответов
+ 3
Use void before the constructor. Then it will work. Because constuctor has no return type. Like this. void Travel (Travel o)
4th Dec 2019, 1:05 PM
A͢J
A͢J - avatar
+ 2
~ swim ~ Ok. So we can create no argument constructor like this Travel () { this.distance = distance; this.time_taken = time_taken; this.speed = this.distance /this.time_taken; }
4th Dec 2019, 1:54 PM
A͢J
A͢J - avatar