+ 3

Hello to all the Java people! I'll really appreciate your comments for my first code which I have shared here, please hit me :)

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

17th Aug 2017, 8:24 PM
Ziv
Ziv - avatar
7 odpowiedzi
+ 5
Nice but you need to do something for error handling in case the user puts invalid input
20th Aug 2017, 8:05 AM
Harsh
Harsh - avatar
+ 3
I think I managed to solve it, you're welcome to check it up :)
22nd Aug 2017, 1:45 PM
Ziv
Ziv - avatar
+ 3
Nice, no more flaws, a point to keep in mind that if you make something like this again, then always remember to use the existing superclass as input,as it causes errors in some cases like this one.
22nd Aug 2017, 2:04 PM
Harsh
Harsh - avatar
+ 2
Hi Harsh, thanks for your comment. I used System.exit(1). isn't it sufficient? if (pick < 1 || pick > 4) { System.out.println("\n The Race can not start because you didn't pick your car!"); System.exit(1); }
20th Aug 2017, 12:03 PM
Ziv
Ziv - avatar
+ 2
Oh I see.. I currently have no idea but I'll try to figure it out. Thanks!
20th Aug 2017, 12:15 PM
Ziv
Ziv - avatar
0
That's okay but try and see what happens when you input "car".
20th Aug 2017, 12:06 PM
Harsh
Harsh - avatar
0
You're welcome
20th Aug 2017, 12:17 PM
Harsh
Harsh - avatar