I've been showed to read file using the following pattern:
File path = new File("src/modul/lorem.txt");
FileReader fr = new FileReader(path);
// ... BufferedReader br = new BufferedReader(fr); ... and so on ...
As far as I know file is a class which represents more a path to class then an actual file: Java Docs Now, when I tried using just a String instead of the File-object ...
// ...
FileReader fr = new FileReader("src/modul/lorem.txt");
// ...
... it worked fine too.
Therefore my question:
What's the purpose of making and using a File-object?
Is there a real benefit? Or is it just a pattern one has seen somewhere and then copied without asking?