vik_2010
April 9th, 2010, 05:12 AM
I was looking through the Java source files, and I cam across an abnormality I hope someone can clarify:
The class "FileSystem.java" is an abstract class - hence, one should not be able to instantiate it directly.
However, the very first variable in File (both FileSystem and File are in the java.io package) creates a FileSystem object via:
public class File implements Serializable, Comparable<File> {
private static FileSystem fs = FileSystem.getFileSystem();
[...]
}
How is it doing this? getFileSystem() in the FileSystem class is just a stub: there is no definition.
If someone could elucidate how this is happening, i would appreciate it. I'm assuming that FileSystem is being concretely defined somewhere, but I don't know what to make of it, nor can I create a mental picture of how this should happen.
The class "FileSystem.java" is an abstract class - hence, one should not be able to instantiate it directly.
However, the very first variable in File (both FileSystem and File are in the java.io package) creates a FileSystem object via:
public class File implements Serializable, Comparable<File> {
private static FileSystem fs = FileSystem.getFileSystem();
[...]
}
How is it doing this? getFileSystem() in the FileSystem class is just a stub: there is no definition.
If someone could elucidate how this is happening, i would appreciate it. I'm assuming that FileSystem is being concretely defined somewhere, but I don't know what to make of it, nor can I create a mental picture of how this should happen.