Advertisement
Guest User

Adam Sangala

a guest
Oct 20th, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.00 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package sk.academy.it;
  7.  
  8. import java.io.File;
  9.  
  10. /**
  11.  *
  12.  * @author IT Academy
  13.  */
  14. public class VypisAdresar {
  15.  
  16.     public static void main(String[] args) {
  17.        
  18.        
  19.         String aktulnaAdresa = System.getProperty("user.dir");
  20.         File aktualnyAdresar = new File(aktulnaAdresa);
  21.  
  22.         String[] mena = aktualnyAdresar.list();
  23.         System.out.println("Aktualne subory: ");
  24.         for (String s : mena) {
  25.             System.out.println("- " + s);
  26.         }
  27.  
  28.        
  29.        
  30.         File[] subory = aktualnyAdresar.listFiles();
  31.        
  32.         System.out.println("\nAktualne subory a velkosti: ");
  33.         for (int i = 0; i < subory.length; i++) {
  34.             System.out.println("- " + subory[i].getName() + " \t"
  35.                     + subory[i].length() + " b");
  36.  
  37.         }
  38.  
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement