Hi
Why does this code return screen output 83? (see screenshot of code)
Later I tried the same code but to return a string and I get an error :
com/codegym/task/task03/task0320/Solution.java:14: error: incompatible types: int cannot be converted to java.lang.String
String name = reader.read();
^
I did get the solution with BufferedReader... so there is no need to post the solution, but what does the InputStreamReader read an int here?
package com.codegym.task.task03.task0320;
/*
The humble programmer
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
InputStreamReader reader = new InputStreamReader(System.in);
int name = reader.read();
System.out.println(name);
}
}