The core concept of Java: interface (interface)

Source: Internet
Author: User

The core concept of Java: interface (interface)

Interfaces are at the same level as classes, and in fact, interfaces are a special kind of abstract class.

Such as:

Interface ia{

}

Public interface: Open Interface

Similar to a class, a file can have only one public interface and is the same as the file name.

A public interface and a public class cannot be defined in a file at the same time.

In an interface, all methods are public, abstract, and all properties are public, static, and constant.

A class implements the format of an interface:

Class Iaimple implements ia{

};

A class implements an interface, which is equivalent to inheriting an abstract class.

1  PackageTomtext;2 //examples of the use of relational operators. 3  Public classtomtext_32 {4      Public Static voidMain (String args[]) {5     floatA =10.0f;6     Doubleb = 10.0;7     if(A = =b) {8System.out.println ("A and B are equal");9}Else{TenSystem.out.println ("A and b are not equal"); One } A } -  -}

The core concept of Java: interface (interface)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.