Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to create and use interfaces in java development tools

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to create and use interfaces in java development tools". The explanation in this article is simple and clear and easy to learn and understand. please follow the editor's ideas to study and learn "how to create and use interfaces in java development tools".

1. Before we start, we need to understand what is the interface of java. For what is the interface of java, today we will not waste our friends' time. You can check and read it in the java interface. After looking up, we know that the interface is a default abstract method, so we do not need to declare it, and a variable in the interface is fixed.

Public static final, then let's create a new interface through the development tool eclipse. I'm sure everyone will create an interface. Students who don't know how to fix it can write three methods in the interface to make a comparison after the creation. The code is as follows:

Package interface Use_T {public void Interface_test_one (); public void Interface_test_two (); public void Interface_test_three ();}

So we've finished creating an interface and writing a method.

two。 Next, we create a new class and then we implement the interface docking through implements. After docking, we input and output the results in the method, so we can get a result of calling the interface. The code and screenshot are as follows:

Package class Interface_Use implements Use_T {@ Override public void Interface_test_one () {/ / TODO Auto-generated method stub System.out.println ("the first interface is used") } @ Override public void Interface_test_two () {/ / TODO Auto-generated method stub System.out.println ("second interface is used");} @ Override public void Interface_test_three () {/ / TODO Auto-generated method stub System.out.println ("third interface is used") } public static void main (String [] args) {Interface_Use iu=new Interface_Use (); iu.Interface_test_one (); iu.Interface_test_two (); iu.Interface_test_three () }} Thank you for reading, the above is the content of "how to create and use interfaces in java development tools". After the study of this article, I believe you have a deeper understanding of how to create and use interfaces in java development tools, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report