Hello! There is a task: to write a program that counts the number of files (files and directories) in this directory and in all contained subdirectories using recursion. There is the following stream of consciousness:
import java.io.*; public class Testament { public static void main(String[] args) { FileFly file = new FileFly(); System.out.println(file.fileFly("c:/chocho/")); } } class FileFly { private File file; private File[] s ; private int c = 0; public int fileFly(String path) { file = new File(path); s = file.listFiles(); for(int j=0;j<s.length;j++) { c++; if(s[j].isDirectory()) fileFly(s[j].getPath()); } return c; } } This is where it stopped. Help with good advice. How to finish this code to work as it should? Thank you in advance.