In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "what are the knowledge points of Java reuse". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Composition, which is used to use the functions of an existing class in a new class rather than its interface, that is, to use an existing class as an internal tool and define its objects as private; in the new class, but in the case of a certain assembly, users of the new class can also directly access the composition components, that is, the objects of the existing class can be defined as public in the new class.
2. Combination, corresponding to the object-oriented "has-a" relationship, inheritance, corresponding to "is a (is-a)" relationship.
3. Protected keyword: for class users, this is private, but for any subclass inherited from this class or any other class in the same package, it is accessible (equivalent to public). Note: protected also provides in-package access.
4. Usually:
Data member private
The method is protected or public
5. For JAVA, the code of the class is not loaded until it is used for the first time, which usually means that it does not load until the first object of the class is built, but it also happens when the static data member or the static method is accessed. The first use is also where static initialization occurs. The loading order of static objects and code is the same as the writing order in the program, and static will only be initialized once.
6. When loading a subclass, regardless of whether or not a base class object is intended to be generated, the base class is loaded, and the loading of the base class is performed first, and then the subclass is loaded
This is the end of the content of "what are the knowledge points of Java reuse class". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.