0

THIS IS MY CODE ,WHY DOES'NT IT RUN??!!! ,PLEASE HELP

import java.util.Scanner; class Main { public static void main(String[] args) { Scanner Age = new Scanner(System.in); int x; x = Age.nextLine(); if(x > 18 && x<50) { System.out.println("welcome to the club"); } else { System.out.println("you are not accepted"); } } }

30th Oct 2018, 4:05 PM
mohamad hoseyn
mohamad hoseyn - avatar
1 Antwort
+ 3
nextLine return String, but x are int. Parse the input to int first then assign to x x = Integer.parseInt(Age.nextLine());
30th Oct 2018, 4:09 PM
Taste
Taste - avatar