0

help me with this code

can anyone make this code work import java.util.Scanner; public class Program{ public static void main(String[] args) { System.out.println("enter your age"); Scanner reader = new Scanner(System.in); int age = reader.nextInt(); System.out.println("Your age is "+age); if(age < 10) { System.out.println("You are eligible to enter "); } else { System.out.println("You are not eligible to enter."); } } } }

4th Jun 2017, 8:10 AM
Rudra Singh
Rudra Singh - avatar
3 Réponses
+ 3
You made a single mistake by adding a closing curly brace "}" at the end which does nothing, just remove the last brace eg https://code.sololearn.com/cs9sGW6kAS9J/?ref=app
4th Jun 2017, 8:17 AM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 2
You have an extra }. Try indentating correctly so you detect this kind of mistakes easily. import java.util.Scanner; public class Program{ public static void main(String[] args) { System.out.println("enter your age"); Scanner reader = new Scanner(System.in); int age = reader.nextInt(); System.out.println("Your age is "+age); if(age < 10) { System.out.println("You are eligible to enter "); } else { System.out.println("You are not eligible to enter."); } } }
4th Jun 2017, 8:19 AM
Maria Zheng
Maria Zheng - avatar
+ 1
thanks guys
4th Jun 2017, 9:34 AM
Rudra Singh
Rudra Singh - avatar