0
Why is it giving error of not being able to compare to an int?
import java.util.Scanner; public class check{ public static void main(String[]args){ boolean a; Scanner x=new Scanner(System.in); a=x.nextBoolean(); if (a==0) System.out.println("Fail"); else System.out.println("Pass"); } }
3 Respuestas
+ 1
compare it to boolean
if(a==false) or if(a==true)
you can make it simpler by
if(a) or if(!a)
0
you cant compare boolean with int in java
compare boolean with boolean or int with int.
0
Then what should I do