Java - Age range with if statement

Description

Age range with if statement

Demo

import java.util.Scanner;

public class Main {
  public static void main(String args[]) throws Exception {
    Scanner sc = new Scanner(System.in);
    System.out.print("Enter age: ");
    int mAge = sc.nextInt();
    if (mAge < 10) {
      System.out.println("baby.");
    } else if ((mAge >= 10) && (mAge < 18)){
      System.out.println("teen.");
    }else if (mAge >= 18) {
      System.out.println("adult.");
    }/* ww  w .j av a  2  s.co m*/
  }
}

Related Topic