Can anyone help me check did i do it correctly? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone help me check did i do it correctly?

import java.util.Scanner; public class Myclass{ public static void Main(String[] args){ int age = 25; Scanner inputage = new Scanner(System.in); age = inputage.nextInt(); if (age <= 25){ System.out.println("Too young"); } else if(age <= 0){ System.out.println("Error"); } else if(age >= 100){ System.out.println("Really?"); } else { System.out.println("Welcome"); } } }

26th Jan 2019, 1:17 AM
Tzion
Tzion - avatar
2 Answers
+ 1
Yes, good job
26th Jan 2019, 2:46 AM
Chris Codes
+ 1
but use scanner only if you need to get some number from the user :)
26th Jan 2019, 2:49 AM
Chris Codes