It is technically possible. But only if you put the Java source code (with the same name / package) into separate source trees and compile them separately.
And then, if you want to use the compiled classes (with the same name / package) in one application, the application needs to use multiple classloaders with different classpaths, and other funky things.
And then, you run into all sorts of odd behaviors; e.g. exception messages like "cannot cast foo.Bar to foo.Bar"
Don't go there. It is better to use different classnames and / or different package names.