0
Whay is wrong
8 odpowiedzi
+ 4
in line 4, change to this: Scanner age=new Scanner(System.in);
in line 5, change the variable name. you can't have 2 variables with same name in java program.
0
import java.util.*;
public class Program {
public static void main(String[] args) {
System.out.println("Enter Age");
Scanner ageInput = new Scanner(System.in);
int age = ageInput.nextInt();
if(age > 0) {
if(age > 16) {
System.out.println("Welcome!");
} else {
System.out.println("Too Young");
}
} else {
System.out.println("Error");
}
}
}
0
now why it's not coming
0
Line 7, nextInt is a function, you need to add parentheses at the end.
a = in.nextInt();
0
okay sir..
0
thanku sir..