Demonstrating collision of package names in java

I got this question as an assignment:

Packages / Naming

We have created many packages and certain classes and interfaces in them. We also discussed the issue that we must remember when calling them. In this assignment, we will see how important it is to name.

Please change the package names in the previous assignment so that the two packages have the same name and analyze the result / errors that will be selected.

My doubt is:

I can’t come up with a way (script) to demonstrate what was asked. Since Java imports are absolute, the situation in question seems impossible (IMO).

Please help me demonstrate this.

Thanks in advance:)

+3
2

, .

- , . , . , JVM jar, . , , , . .

( , Pure Java , IDE .)

+3

, , . Eclipse, . " " "Refactor- > Rename". .

:

JavaProjectA
   src
     com.some.package
         ClassA
JavaProjectB
   src
     com.another.package
         ClassA

. - . :

JavaProjectA
   src
     com.some.package
         ClassA
JavaProjectB
   src
     com.some.package
         ClassA

ClassA .

+3

Source: https://habr.com/ru/post/1768690/


All Articles