Import classes inside JAR files in the default package

How can I use Queue here?

I cannot get the import to work because Queue.class is not included in the package.

I have tried everything in this universe and much more.

imagehttp://i.stack.imgur.com/AFrrc.jpg

+3
source share
1 answer

Your class Queueis under an unnamed package (see JLS ). It cannot be imported. Also, this is bad practice.

You have two options.

  • Move your own code to an unnamed package. Theoretically, both of them are in the same package, you will not need to import Queue, because its class name is enough to recognize the class.

  • JarJar - Jar. Jar, Queue, . Fully Qualified Class Name (FQCN) .

2.


1: . Java?

+6

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


All Articles