Answer:
if (user_age<=18){
System.out.println("18 or less");
}
Explanation:
The above expression in Java will print "18 or less" if the input is less than 18.
Consider a complete java program that request a user to input his/her age below and prints "18 or Less" if the user age is less or equal to 18.
import java.util.Scanner;
public class num2 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("enter age:");
int user_age =in.nextInt();
if (user_age<=18){
System.out.println("18 or less");
}
else
{
System.out.println("greater than 18");
}
}
}