fork download
  1. import java.net.*;
  2. import java.io.*;
  3. public class ch723{
  4. public static void main(String[] args){
  5. try{
  6. URL url = new URL("http://1...content-available-to-author-only...t.com/-mHZuSuHYbnw/T3EPIhJ7cEI/"+
  7. "AAAAAAABX6A/Km21rMePy24/s1600/02.jpg");
  8. BufferedInputStream buf = new BufferedInputStream(url.openStream());
  9. // FileInputStream buf = new FileInputStream("c:\\copy_vivi.jpg");
  10. byte[] input = new byte[buf.available()];
  11. int r = buf.read(input,0,input.length);
  12. buf.close();
  13.  
  14. FileOutputStream fout = new FileOutputStream("c:\\vivi.jpg");
  15. fout.write(input,0,input.length);
  16. fout.close();
  17. System.out.println("ok!");
  18. }catch(Exception e){}
  19. }
  20. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:3: class ch723 is public, should be declared in a file named ch723.java
public class ch723{
       ^
1 error
stdout
Standard output is empty