The following code within a program allows 90 to be assigned to the variable 'ch'. 'Z' is then printed to the console.
char ch;
ch = 90;
System.out.println(ch);
However, the following code, that lies within a program, does not compile. If the following code requires the input to the ch variable to be a character type, i.e. (char) System.in.read();, then why does the same not apply when 90 is assigned to ch above? Why doesn't it have to be ch = (char) 90?
char ch;
ch = System.in.read();