Bapa

Untitled

Mar 17th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. import java.io.*;
  2.  
  3. class MyClass
  4. {
  5. public static void main(String args[])
  6. {
  7. try
  8. {
  9. FileOutputStream fos = new FileOutputStream("abc");
  10. DataOutputStream dos = new DataOutputStream(fos);
  11. dos.writeByte(12);
  12. fos.write(100);
  13. fos.close();
  14. dos.close();
  15.  
  16. FileInputStream fis = new FileInputStream("abc");
  17. DataInputStream dis = new DataInputStream(fis);
  18. byte b = dis.readByte();
  19. System.out.print(b + " ");
  20. int i = dis.readInt();
  21. System.out.println(i);
  22. fis.close();
  23. dis.close();
  24. }
  25. catch(IOException e)
  26. {
  27. System.out.println("An exception occurred");
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment