Answer:
import java.util.Scanner;
public class num9 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter year");
int givenYear =in.nextInt();
if(givenYear>=2101){
System.out.println("Distant Future");
}
else if(givenYear>=2001){
System.out.println("21st Century");
}
}
}
Step-by-step explanation:
- Using Java programming Language
- Import Scanner class to receive user input of the variable givenYear
- Use if statement to check the first condition if(givenYear>=2101)
- Use else if statement to check the second condition if(givenYear>=2001)
- print Distant future and 21st century respectively