Find errors in code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
9th Feb 2021, 6:10 AM
Sahil Chib
Sahil Chib - avatar
2 Answers
+ 3
public class Program { public static void main(String[] args) { int age = 22; int money = 800; if (age >= 18 && money > 500) { System.out.println("Welcome!"); } else if (age < 18) { System.out.println ("thanks"); } } } You can also take into account when age takes the value 18; thats why i added the age >= 18 Maybe you should read lesson 14.1 of the Java course (logical operators) Hope it helps
9th Feb 2021, 6:33 AM
Gonzalo da Cruz
Gonzalo da Cruz - avatar
+ 1
Gonzalo da Cruz yes good explanation thanks))
9th Feb 2021, 6:34 AM
Sahil Chib
Sahil Chib - avatar