Jakub Gruber Jakub Gruber - 8 days ago 5
Java Question

Extends class from above package

I have a package with

AbstractTestCase
class that I'd like inherit from in all test classes that are in sub-packages, i.e.
BaseDaoTestRunner
. (See image below)

Project structure

Problem is that I cannot inherit from that class. I know it's some basic mistake, but I'll appreciate every help provided.

Is it because it's in
test
and not classic
src/main
?

Answer

Is it because it's in test and not classic src/main

No. It's because it's in the default package, and you can't import any class from the default package.

Don't, ever, put anything in the default package. Put all your classes under the standard reverse-dns structure: com.mycompany.myproject...

Comments