Last active
August 29, 2015 14:18
-
-
Save Sergaav/6721426403becfed7f27 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gmail.sergaav.dz7_1; | |
import java.io.*; | |
import java.util.Scanner; | |
public class dz7_1 { | |
public static void main(String[] args) throws FileNotFoundException { | |
File ff = new File("file.txt"); | |
try { | |
if (!ff.exists()) { | |
ff.createNewFile(); | |
} | |
} catch (IOException e) { | |
System.out.println(e); | |
} | |
Scanner sc = new Scanner(System.in); | |
PrintStream writer = new PrintStream(ff); | |
for (;;){ | |
String data = sc.nextLine(); | |
writer.printf(data+"\n", ff); | |
writer.println(); | |
if (data.equals("")){ | |
break; | |
} | |
} | |
sc.close(); | |
writer.close(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment