0
what is the problem in "else"
public class elsetest { public static void Main(String[]args) { int b=3; int c=4; if (b<c) { System.out.println(b); } else {System.out.println(c); } } }
4 odpowiedzi
+ 7
You have terminated the if statement with a semi colon, right after the condition. So if statement has already ended, so using else will raise an error as else is only used in an if statement
Remove the semi colon after if condition, and you are good to go.
+ 5
aminul islam hnc check mark my answer if this helped you
+ 1
Remove semicolon from if (b<c)
It will work
+ 1
thank you for answer