// Imports the Scanner class for usage in the program...
import java.util.Scanner;
public class elseIf {
public static void main(String[] args) {
// Creates a new Scanner object that looks at System.in for input (which is the console)
Scanner scan = new Scanner(System.in);
// Outputs "Your age please: " with a space at the end and doesn't break to a new line after output
System.out.print("Your age please: ");
// Gets what the user typed and stores it in input
String input = scan.next();
// Converts what the user typed (input) into an Integer which can then be stored into an int.
int age = Integer.parseInt(input);
if (age >=18) {
// print prints the string and doesn't break to a new line after output
// \n is a line break. Helps with formatting correctly...
System.out.print("\nYou're getting old ");
} else if (age < 18) {
System.out.print("\nYou're a young one ");
}
// println prints the string and DOES break to a new line after the output
System.out.println("at the age of " + age);
}
}