Hello!
Consider this code
import java.util.Arrays; public class test { static boolean isDigit(char ch) { if( '0' <= ch && ch <='9') { Out.println("true"); return true; } else { Out.println("false"); return false; } } public static void main (String[] args) { Out.println("Put in a digit"); char ch = In.readChar(); isDigit(ch); } }
Now the goal is to print out true whenever we input a number between 0 and 9,and for every other number we want to print out false.But for some reason it is always printing out true,no matter what number I put in.Worth mentioning is that the numbers are not int but char.Why does it print out true even for values of 120 ?