Skip to content

Tag: packages

Why is package-protected method not visible in the same package?

Assume we have two packages p1 and p2 and classes p1.M1 extended by p2.M12 as follows: Let’s extend M12 with p2.B: This gives a compilation error as method1, being package-protected within p1 is not visible in p2. method2 is visible without problems. Now let’s extend p2.M12 with p1.A: Here I’m getting a compilation error for both method2() (which is understandable)

Is there a way to make empty packages visible in Eclipse?

Is there a way in Eclipse, to see empty parent packages? I have an issue freely viewing/accessing package that only contains 2 sub-packages: I tried creating that package again, because I thought that i might not have it in my eclipse project, but it won’t let me: How do I prevent “views from filtering empty parent packages”? Answer In

Importing packages in Java

How to import a method from a package into another program? I don’t know how to import… I write a lil’ code: package Dan; public class Vik { public void disp() { System.out.println(…