General J2EE: Any problems with extending a class from another package?

  1. Aside from method/field visibility, are there any big issues with writing a class that extends something from another package?

  2. Nope, the only issue is the organisation of your code. I regularly separate type from implementation by using different type and impl packages. Never encountered problems with this approach. Furthermore, it's relatively common if you use a 3rd party frameworks.

  3. Classes which are not defined public can't be accessed from outside the package.
    This can be an issue if you would have to override a class out of a library where the libraries' author did not think of that scenario.

    You can use packages to control class access in your own code, too. If you know that a certain class is and should only be used by another class in the same package you can define it non-public

    package foo;

    class Bar

    to forbid access from another package.