+ 1
Why this code is not working?
import java.util.Scanner; public class Nested_interval{ public static void main(String[] args){ Scanner b = new Scanner(System.in); int a= b.nextLine(); if (a<19){ if (a>15){System .out.println("You are a teen. ");} else {System.out.println("You are a Child.");} }else{ System.out.println("You are young! ");} } } https://code.sololearn.com/c3P39UxfzXf6/?ref=app
7 Respuestas
+ 3
It's working. Look at the code
https://code.sololearn.com/cgM19GnZ8wy8/?ref=app
+ 2
ahsan rzingpa , line 9 => right method is nextInt().
+ 1
ahsan rzingpa , nextLine() method is used for reading a string, but you declared the variable as int type. That is why it is not possible.
+ 1
ahsan rzingpa , you are welcome 🐱
0
Still not working
0
Thank you,but why there in" nextInt" not"nextLine".
0
Thank you so much.