+ 2

Hi, I'm early into my Java days so take it easy please. Trying to recall a code that makes for a functional traffic, thoughts?

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

9th Nov 2018, 9:43 AM
Adam O'Beirne
Adam O'Beirne - avatar
3 Answers
+ 3
Couple errors. When you use esle, you can not test condition. Use else if to test red light. I guess you were missing 1 curly brace and ";" after System.out.println("stop"); I can not show you fixed code as app says no internet connection :/So correct those errors that I mentioned and show us again if it does not work.
9th Nov 2018, 10:04 AM
Sad
Sad - avatar
9th Nov 2018, 11:39 AM
Danijel Ivanović
Danijel Ivanović - avatar
+ 2
All fixed, Thanks for your help, I didnt know you couldn't test with 'else', and the other two were just sloppy mistakes, probably made in the course of trying to fix it. Runs now though ,thanks :) https://code.sololearn.com/cLoibc2Vz8jl/?ref=app
9th Nov 2018, 10:11 AM
Adam O'Beirne
Adam O'Beirne - avatar