> Hello,
>
[quoted text clipped - 7 lines]
> Thanks,
> Hilbert
Sometimes it's useful to have a very small utility class that is used
solely within a larger class. They're so tightly coupled that it's
convenient to have them together in one file.
Sometimes you don't want to implement the utility class as an inner
class because inner classes can cause problems. Some obfuscators, for
example, don't handle them very well.
I would not put two large classes together in one file, nor would I
include a secondary class in a file if it were used anywhere outside
that file.
Adam Maass - 16 Jul 2006 00:26 GMT
>> Hello,
>>
[quoted text clipped - 19 lines]
> include a secondary class in a file if it were used anywhere outside that
> file.
I agree with you (mostly), but must point out the history:
The capability for multiple classes in one source file dates all the way
back to Java 1.0, (IE, to before inner classes). In 1.0, a small utility
class used only by one other class in the same package could be handled by
putting it in the same source file as that class.
Since the introduction of inner classes, this really (really) should be
handled as a static class member of the one class that uses it.
-- Adam Maass
Hilbert - 16 Jul 2006 14:19 GMT
Thanks for the info!
Thanks,
Hilbert
> >> Hello,
> >>
[quoted text clipped - 31 lines]
>
> -- Adam Maass