Skip to content
Advertisement

Java error: Only a type can be imported. XYZ resolves to a package

I get the error: “Only a type can be imported. XYZ resolves to a package.”

Someone has explained the cause here but I am not sure what I supposed to do to fix this. FYI: I am using Eclipse. I have added the code that does the importing below. The java.util.* import works fine.

JavaScript

Edit: the actual error is below:

JavaScript

Advertisement

Answer

OK I just solved it. In the last import I added a “;” by copying other code examples. I guess it’s the standard line ending that is required.

So

JavaScript

became

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement