Question: Please write this in java Rewrite the following program so that it uses try-with-resources to eliminate the calls to closeC). Use only one try block.

Please write this in java

Please write this in java Rewrite the following program so that it

uses try-with-resources to eliminate the calls to closeC). Use only one tryblock. import java.io. class NoTrywithResources public static void main(String arga) PileInputStream fin-null;

Rewrite the following program so that it uses try-with-resources to eliminate the calls to closeC). Use only one try block. import java.io. class NoTrywithResources public static void main(String arga) PileInputStream fin-null; FileOutputStream fout null ; // First make sure that both files have been specified if(args.length != 2) { System.out.println("Usage: NoTrywithResources Prom To") return; try( fin-new FileInputstream(args [o]) catch (IOBxception exc) System.out printin("IOException: program halted.") try f fout new FileOutputStream (args [1] ) ; catch (IOBxception exc) System.out printin("IOException: program halted.") try if (fin-null&& fout!null) int c = fn . read ( ); fout.write(c)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!