In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article shows you how to view the class inheritance diagram and class source code in IDEA, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
We all know that IDEA this development tool is very easy to use, a lot of functions, today when reviewing the Java collection system, want to see a class or interface inheritance structure, and then search for a wave, are using IDEA Diagram plug-ins, here also share.
For example, I wrote a code like this.
Public class CollectionLearning {public static void main (String [] args) {List list = new ArrayList (); list.add ("java"); list.add ("Android"); list.add ("python"); list.add ("front end"); / / lambda+ method reference: traversing list collection element list.forEach (System.out::println);}}
Then I want to see the inheritance structure of ArrayList. We can right-click on the ArrayList class and select Diagram in the pop-up dialog.
Two options are displayed:
Show Diagram... -- > display the class inheritance structure diagram on the new tab
Show Diagram Popup... -- > display the class inheritance structure diagram in the pop-up layer of the current page
It feels better to show it on the new tab, and we can see the inheritance structure diagram of ArrayList.
This makes it very clear. Sometimes we think that displaying all the related classes or interfaces takes up too much of the screen. We can also delete a class or interface that we don't care about. Click on a class or interface and hold down the delete key to delete it.
We deleted the Cloneable, Serializable, and RandomAccess interfaces, and we noticed that there were different colors and dotted arrows on it, which marked the relationship between class and class, class and interface.
Blue solid line arrow: inherit green solid line arrow between classes: inherit green dashed line arrow between interfaces: class implements interface
Sometimes it's not enough to look at the class inheritance structure diagram, we also think about methods, variables, constructors, and so on. We can right-click on the current page
In the figure above, we can choose to display variables, constructors, methods, properties, and inner classes. Let's click on Fileds
So we show the variables of the class or interface involved in the inheritance structure diagram, and then click on the constructor
This will also show all the constructors, which is very fast for us to quickly understand the internal structure of a class, and our above operation can also be done using the Quick Toolbar.
We can also quickly get into the source code of a variable or method. We double-click a class or interface, and the mouse will swim in it, and then we select Jump to Source for a method to enter the source code
Sometimes we feel that the picture displayed is too small to see clearly, so we can use the magnifying glass function, press and hold the Alt key, and move the mouse to where is the magnifying glass.
Sometimes we want to see if other classes are related to the current class, so we add other classes, right-click and select Add Class to Diagram...
A dialog box pops up
We enter the class name into the class and press enter. Here I enter the Map interface
In this way, we know that ArrayList has nothing to do with Map (it may be superfluous here, because it already shows all the inheritance structure diagrams of the current class)
The above is how to view the class inheritance diagram and class source code in IDEA. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.