Why doesn't Intellij recognize the class "Rectangle"

Answered

Hi, does anyone know why Intellij does not recognise the class Rectangle? The characters are in red and grey. 




5 comments
Comment actions Permalink

Hello,

"Rectangle" is not in the same package as "Main" and it is not imported there. That's why class is not found.

 

0
Comment actions Permalink

Hello. Sorry for being such a noob and thank you for your reply but how can I import "Rectangle" into main?

0
Comment actions Permalink

You could put it into "com/kermit" package or into "com/<new package>", then put caret on "Rectangle" in Main, press Alt+Enter and select import class.

0
Comment actions Permalink

And it works! Thank you for teaching!

0

Please sign in to leave a comment.