Почему не работает???(объясните ) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Почему не работает???(объясните )

public class Program { public static void main(String[] args) { int age = 25; int money = 100; { if (age > 18 || money > 500) System.out.println("Welcome!"); { if (age > 16 && money > 200) System.out.println("<redacted>"); } } } }

9th Sep 2019, 10:55 AM
Виктор Кулишкин
1 Answer
+ 9
You need to place the opening curly bracket { after the condition, not before the if statement. Example: if (age >18) { System.out.println("hi") ; } Потому что открывающая фигурная скобка { должна стоять после закрывающей скобки ) с условием, а не перед If.
10th Sep 2019, 8:48 PM
Igor Makarsky
Igor Makarsky - avatar