I read online about inner class, but my nquestion here is about a java main class having other small classes outside the main class but in the same file.
I want to know in general whether this is a good design over inner classes/ putting the class in its own file.
But by encapsulation should i be grouping things together where they are used?
File Name : MainClass
public MainClass{
....
}
class InnerClass{
}
What is the advantage of this over inner class and is this a good design pattern to start of with
Everywhere i have read online they state about inner classes in this way
File Name : MainClass
Public MainClass{
class innerClass{
}
}
Why someone prefers the frist one over the second, when the secon class is a non-static one?
Aucun commentaire:
Enregistrer un commentaire