Datasets:
ArXiv:
License:
Stack-Repo / data /train /akash-coded /FSD_Java /Lesson-3 /File Handling /Examples /FileCreateDemo.java
Download data/train/akash-coded/FSD_Java/Lesson-3/File Handling/Examples/FileCreateDemo.java from RepoFusion/Stack-Repo: direct link, hf CLI and curl.
- Browser
- Download file 441 Bytes
-
https://huggingface.co/datasets/RepoFusion/Stack-Repo/resolve/bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Lesson-3/File%20Handling/Examples/FileCreateDemo.java
- Command line
-
hf download 'hf://datasets/RepoFusion/Stack-Repo@bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Lesson-3/File Handling/Examples/FileCreateDemo.java'
-
curl -L -o FileCreateDemo.java https://huggingface.co/datasets/RepoFusion/Stack-Repo/resolve/bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Lesson-3/File%20Handling/Examples/FileCreateDemo.java
441 Bytes
| import java.io.*; | |
| public class FileCreateDemo { | |
| public static void main(String[] args) { | |
| try { | |
| File file = new File("javaFile123.txt"); | |
| if (file.createNewFile()) { | |
| System.out.println("New File is created!"); | |
| } else { | |
| System.out.println("File already exists."); | |
| } | |
| } catch (IOException e) { | |
| e.printStackTrace(); | |
| } | |
| } | |
| } | |