jest jest - 7 months ago 43
Java Question

what does this syntax in Java mean?

I'm a Java newbie and stuck with this:

BufferedReader br1 = new BufferedReader(new InputStreamReader(;


InputStreamReader ISR = new InputStreamReader(;
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?



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.