Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File;
- public class HW01_1 {
- public static void main(String[] args) {
- File f = new File(args[0]);
- int vkupno = 0;
- float prosek = 0;
- try{
- for(File file : f.listFiles()){
- if(file.isFile()){
- if(file.getName().contains(".txt")){
- vkupno++;
- prosek+=file.length();
- }
- }
- }
- }finally {
- System.out.println(prosek/vkupno);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement