+ 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"); } } }
3 Answers
+ 1
Yes, good job
+ 1
but use scanner only if you need to get some number from the user :)