1. Generic type
2. Parameter
3.jdk1.7 Writing
public class Testclosestream {public static void main (string[] args) {}//1.7 new attribute Try-with-resousce, real or Try{}catch
public static void Closestream () throws exception{file src = new file ("E:/workspace/images/bg.jpg");
File Dest = new file ("E:/workspace/images/bg11.jpg");
InputStream is = null;
OutputStream OS = null;
Try (is = new Bufferedinputstream (new FileInputStream (SRC));
OS = new Bufferedoutputstream (new FileOutputStream (dest));
) {byte[] car = new byte[1024];
int len = 0;
while ( -1!= (len = is.read (car))) {Os.write (car);
} os.flush ();
Os.close ();
Is.close (); }///Using generic public static <t extends closeable> void CloseAll (T...io) {for (closeable Temp:io) {if (null!=
Temp) {try {temp.close ();
catch (IOException e) {e.printstacktrace (); }}//variable parameters: Only the last parameter of the formal parameter, treated in the same way as the array public static void Close (Closeable...io) {for (closeable Temp:io) {if nu
ll!= temp) {try { Temp.close ();
catch (IOException e) {e.printstacktrace ();
}
}
}
}
}