diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2019-02-18 08:10:10 -0500 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2019-02-18 08:10:10 -0500 |
commit | b4dbd2cfa724476162fa6d35941a5d7cdc9c9524 (patch) | |
tree | 431af0b75efa29dfa3bab2868a78ab0eb29173c7 /CS2452/assign2/src | |
parent | e8b1808eaf87a49e4c34ebbfb66854baa627418c (diff) |
Adds all assignments not previously in a git repo
Diffstat (limited to 'CS2452/assign2/src')
-rw-r--r-- | CS2452/assign2/src/P1.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/CS2452/assign2/src/P1.java b/CS2452/assign2/src/P1.java new file mode 100644 index 0000000..3580cf9 --- /dev/null +++ b/CS2452/assign2/src/P1.java @@ -0,0 +1,39 @@ +import java.io.*; + +class P1 +{ + + public static void main(String[] args) + { + String str = null; + BufferedReader br; + br = new BufferedReader(new InputStreamReader(System.in)); + BufferedWriter bw = null; + + try + { + File file = new File(args[0]); + + if (! file.exists()) + { + file.createNewFile(); + } + + bw = new BufferedWriter(new FileWriter(file)); + while(true) + { + str = br.readLine(); + bw.write(str); + bw.newLine(); + bw.flush(); + } + } catch(Exception e) + { + System.out.printf("Unable to write to file %s\n", args[0]); + } + + + + + } +} |