In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
In this issue, Xiaobian will bring you about how Idea analyzes the relationship between classes. The article is rich in content and analyzes and narrates from a professional perspective. After reading this article, I hope you can gain something.
preface
When you read the source code and see the various classes and interfaces inherited to implement it, do you not know who his father (parent class) is, who his grandfather (parent class) is, and only who his ancestor is (Object class)? After all, the relationship between classes is too unclear to say, can only say "your circle is really chaotic"
It doesn't matter, Idea has a super powerful and very practical thing, which can make you understand those between them at once and easily handle the relationship between them. After all, no one wants to be a father."How come I suddenly have an internal class? Is he my internal class?" Just look at how green the interface is. He doesn't even know how many children he has.
The meaning of the line.
Blue solid line--> Inheritance
Green dashed line--> Implementation
Red Implementation--> Internal Classes
Let's take ReentrantLock as an example.
forgiveness color
We see that Sync is an abstract class that is an inner class of the ReentrantLock class, and we look at the class diagram relationships, which are represented by red lines.
Let's look at another class AbstractQueuedSynchronizer.
blue
two modes
The first one is the one I showed you at the beginning, and it opens in a separate window.
The second one will pop up a window directly next to the class, showing the relationship.
And we go in like this, not like I started with all sorts of unintelligible fathers and uncles, because it starts out showing only direct parent classes and implemented interfaces.
Let's find his father first.
Reentrant Lock is a rich second generation, he has no grandfather, ancestors, only a father. because he doesn't inherit classes other than Object.
Find his adopted son (inner class, not inherited from him)
Filter, sift
This way you can jump directly into the source code
Add other classes
Sometimes you don't think this class is what you want. You have to compare horizontally to find his uncle (grandfather is the same, but there is no direct inheritance relationship) or brother and sister (father is the same class).
You can right-click on this.
Then type in the class you want to add, such as the Thread class
Then it will be added. If they have no relationship (if they are classes, they will have a relationship, after all, they inherit from Object, but if the parent class is not loaded, they are considered to have no relationship), then there will be no connection. For example, we delete the Object class.
last
With something like this, I don't think you should be confused about the relationship between classes and classes/(interfaces) no matter what you read or do.
I wish everyone can happily read the source code and interpret the relationship between them.
The above is how to analyze the relationship between classes in Idea shared by everyone. If there is a similar doubt, please refer to the above analysis for understanding. If you want to know more about it, please pay attention to 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.