0

Can you hep me to find error

/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package age; public class Age { public static void main(String args[]) { System.out.println("Age group: "); int a=in.nextInt(); in.close(); if (a>=0 && a<=35) { System.out.println("youth"); } else if (a>=36 && a<=60) { System.out.println("middle Age"); } else if (a>=61 && a<=120) { System.out.println("old age"); } else { System.out.println("Invalid age"); } } }

31st Jul 2021, 9:56 AM
Nshimiyimana Aime
Nshimiyimana Aime - avatar
1 Resposta
+ 6
I think there is no need to write this line: package age; Next, you have to import java.util.*; at the beginning. Then, you have to write "Scanner in= new Scanner(System.in); " this line for taking input,inside main() function since you have used in.nextInt(); for taking input. Maybe your code should be like this: https://code.sololearn.com/cA45A23600a6
31st Jul 2021, 10:02 AM
The future is now thanks to science
The future is now thanks to science - avatar