Advertisement
ivana_andreevska

Kreiranje na FIle

Feb 25th, 2022
839
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. import java.io.*;
  2. import java.io.File;
  3.  
  4. public class Main {
  5.     public static void main(String[] args) throws IOException {
  6.         File file = new File("path2.txt"); // kreiram nov txt file
  7.         /*
  8.        fileot se naoga vo src oti tamu se pisuva momentalno
  9.        ako sakam da kreiram mozam i vo drugi pateki
  10.        File file=new File("C:/Users/Nesto/Desktop/path/txt");
  11.        File file=new File("C:/
  12.         */
  13.         file.createNewFile();
  14.  
  15.         if (file.exists()) {
  16.             //proverka dali file-ot postoi
  17.             System.out.println(file.length());
  18.         }
  19.     }
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement