What\'s the reason of making top-level class non-public in Java?
Let\'s say we have Foo.java, there could be
class Foo {
}
Here is an example. No one needs to know about existence of our ConcreteDocument.
DocumentIF.javapublic interface DocumentIF {
}
ConcreteDocument.javaclass ConcreteDocument implements DocumentIF {
}
DocumentFactory.javapublic class DocumentFactory {
public DocumentIF createDocument() {
return new ConcreteDocument();
}
}