Advertisement
Guest User

Untitled

a guest
Sep 9th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.40 KB | None | 0 0
  1. import java.io.*;
  2. public class WriteBytes {
  3.     public static void main(String args[]) {
  4.         byte[] cities = { 'n', 'e', 'w', 'y', 'o', 'r', 'k', '\n', 'd', 'c' };
  5.         try (
  6.             FileOutputStream outfile = new FileOutputStream("newfile.txt");
  7.         ) {
  8.             outfile.write(cities);
  9.         }
  10.         catch (Exception e) {
  11.             e.printStackTrace();
  12.         }
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement