jest jest - 1 year ago 91
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?


Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download