Scanner scanner = new Scanner(System.in);
String name = scanner.nextLine();
int age = scanner.nextInt();
if (age >= 18) {
if (age <= 28) {
System.out.println(name + militaryCommissar);
}
}
}
Solution
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Stroidzz
17 April 2023, 15:34
Thanks. Instead of two seperate "if statements" I used the "or" opperation in one. Turns out the last requirement doesn't like that...
0
Thomas
17 April 2023, 16:34
If you use OR, then every age would pass your if clause. You probably intended to use AND.
+1