In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
Most people do not understand the knowledge points of this article "how to create an interface implementation class in java", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to create an interface implementation class in java" article.
The operating environment of this tutorial: windows7 system, java10 version, DELL G3 computer.
1. Create instructions
(1) when Java uses interface variables to call a method that implements a class object, the method must make a declaration in the interface. In the interface implementation class, the type and parameters of the method must match correctly with those defined in the interface.
(2) the variable declared by the interface is assigned as a reference to the object of the implementation class of the interface, such as List list = new ArrayList ()
Here List is the interface and ArrayList is the implementation class of List.
2. Examples
Public interface animals {/ / create animals interface void cry (); / / it is an abstract class of public abstract but String getAnimalName () can be omitted. / / same as above,} / / the interface body contains two parts: constant declaration and abstract method. The interface body has only abstract methods, no ordinary methods / / and the access permissions of all constants in the interface body must be public and static constants. You can omit the public, final, static modifiers / / the access permissions for all abstract methods are public _ all abstract methods must be public, and the collections in the collection class Java that allow omitting the public static modifier Java are divided into four main categories:
1. List list: ordered and repeatable
2. Queue queue: orderly and repeatable
3. Set collection: non-repeatable
4. Map mapping: unordered, key unique, value not unique.
The above is the content of this article on "how to create interface implementation classes in java". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please 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.