Skip to content

Instantly share code, notes, and snippets.

@asolntsev
Created June 8, 2020 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asolntsev/73dfde2f869805493734d2d962bbca07 to your computer and use it in GitHub Desktop.
Save asolntsev/73dfde2f869805493734d2d962bbca07 to your computer and use it in GitHub Desktop.
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
public class FileTest {
public static void main(String[] args) throws IOException {
int[] numbers = new int[] {1,2,3,4,5};
try (PrintWriter writer = new PrintWriter(new FileWriter("zopa.txt"))) {
for (int number : numbers) {
writer.println(number);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment