0

please tell me what is the error?? i need to give age as input

import java.util.Scanner ; public class Program { public static void main(String[] args) { Scanner age = new Scanner(Systrm.in) ; if(age <= 0){ System.out.println("Error"); } else if(age <= 16) { System.out.println("Too Young"); } else if(age < 100) { System.out.println("Welcome!"); } else { System.out.println("Really?"); } } }

25th Jul 2017, 5:13 PM
Shehin Kuniyil Tharuvai
Shehin Kuniyil Tharuvai - avatar
9 Answers
+ 1
age is not defined anywhere
25th Jul 2017, 5:38 PM
Sreejith P
Sreejith P - avatar
+ 1
check this line Scanner age= new Scanner(System.in); spelling of System is wrong
25th Jul 2017, 5:21 PM
Devbrath
Devbrath - avatar
+ 1
int age = ageScan.nextInt();
25th Jul 2017, 5:28 PM
Devbrath
Devbrath - avatar
+ 1
int age = ageScan.nextInt(); You need to define what age is.
25th Jul 2017, 5:28 PM
Rrestoring faith
Rrestoring faith - avatar
0
import java.util.Scanner ; public class Program { public static void main(String[] args) { Scanner ageScan = new Scanner(System.in) ; age =ageScan.nextint(); if(age < 0){ System.out.println("Error"); } else if(age < 16) { System.out.println("Too Young"); } else if(age < 100) { System.out.println("Welcome!"); } else { System.out.println("Really?"); } } } i made it like this
25th Jul 2017, 5:23 PM
Shehin Kuniyil Tharuvai
Shehin Kuniyil Tharuvai - avatar
0
but still error
25th Jul 2017, 5:24 PM
Shehin Kuniyil Tharuvai
Shehin Kuniyil Tharuvai - avatar
0
age=ageScan.nextInt();
25th Jul 2017, 5:25 PM
Devbrath
Devbrath - avatar
0
canot find symbol age
25th Jul 2017, 5:26 PM
Shehin Kuniyil Tharuvai
Shehin Kuniyil Tharuvai - avatar
0
it works when i put int age after main opening
25th Jul 2017, 5:37 PM
Shehin Kuniyil Tharuvai
Shehin Kuniyil Tharuvai - avatar