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
4 Réponses
+ 3
Use void before the constructor. Then it will work. Because constuctor has no return type. Like this.
void Travel (Travel o)
+ 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;
}