I’m a Java newbie and stuck with this:
BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));
and
InputStreamReader ISR = new InputStreamReader(System.in);
BufferedReader BR = new BufferedReader(ISR);
-
What is the difference between them?
-
Also, is it compulsory to throw IOException when i’m getting inputs from user?
thanks.
The only difference is that the second form explicitly saves the reference to the InputStreamReader to a variable, which may or may not be useful depending on if you do something with it afterwards.