FileVisitor Interface Sample

In this sample file visitor interface you can list all the folders and their regarding files   import; import java.nio.file.FileVisitResult; import java.nio.file.FileVisitor; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributes; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class MyFileVisitor implements FileVisitor<Path> { private Map<String, List<String>> data = new HashMap<>(); private Map<String, IOException>

Binding of variables and methods at compile time and runtime

You can use reference variables of a base class to refer to an object of a derived class. With inheritance, the instance variables bind at compile time and the methods bind at runtime. Examine the following code: class Employee { String name = "Employee"; void printName() { System.out.println(name); } } class Programmer extends Employee { String name