0
Need Some Help in Java!!
Guys I am having some problem while running this code can anyone suggest me what is the problem import java.util.Scanner; public class Program { public static void main(String[] args) { String age = new Scanner(System.in).nextLine(); if (age > 17){ System.out.println("You are an Adult"); }else{ System.out.println("You are not an Adult"); } } }
4 Answers
+ 2
Age is a string, change this to int and nextLine() to nextInt()
+ 1
Type error you are matching string with integer that's the problem
0
But how to change it into integer