Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to quickly find the fully qualified name of a class

I been giving IntelliJ a spin, and loving it so far. But, I got a question, is there any way of quickly getting the fully qualified name of a class from within the editor?

So, if I have some code like

Element element = new Element(); 

I could quickly get the fully qualifed name of Element, for example, com.whatever.Element

like image 246
JustDanyul Avatar asked Aug 16 '13 13:08

JustDanyul


People also ask

How do you find the fully qualified name of a class?

The fully-qualified class name can be obtained using the getName() method.

What do you mean by fully qualified name?

The term fully qualified file name (or FQFN) means a file on a computer whose exact name is completely specified such that it is unambiguous and cannot be mistaken for any other file on that computer system.

Can we give fully-qualified class name instead of importing the class?

If you use fully qualified name then only declared class of this package will be accessible. Now there is no need to import. But you need to use fully qualified name every time when you are accessing the class or interface. It is generally used when two packages have same class name e.g. java.


1 Answers

Press Ctrl+Alt+Shift+C (Edit | Copy Reference) on "Editor" in the code and you'll have the fully-qualified name in your clipboard.

Or alternatively just right-click on the code and select "Copy Reference".

like image 69
Peter Gromov Avatar answered Sep 23 '22 11:09

Peter Gromov