Problem with else

i have problem with " else" statement in java. i can not fix that. every time i write else, it is saying you have error. How can i fix that?

How are we supposed to help you if you neither share your code nor the error message?

Remove the semicolon after the condition. It terminates the if statement so your println() will be executed unconditionally and an else is syntactically not allowed without an corresponding if.

1 Like