
#Java interface is not a class, because classes are defined using the class keyword and interfaces are defined using interface. # A collection of method characteristics.
Java interface is a series of method declarations and a collection of method characteristics. An interface only has method characteristics but no method implementation, so these methods can be used differently in different places. Class implementations, and these implementations can have different behaviors (functionality).
Two meanings:
Two, one The collection of characteristics of methods possessed by a class is a logical abstraction. The former is called "Java interface" and the latter is called "interface".
The Java interface itself does not have any implementation, because the Java interface does not involve representation, but only describes public behavior, so the Java interface is more abstract than the Java abstract class.But the interface is not a class, and you cannot use the new operator to instantiate an interface.
Such as x=new comparable(...);//This is an error. But the interface variable Comparable x can be declared; //This is allowed.Methods of Java interfaces can only be abstract and public. Java interfaces cannot have constructors. Java interfaces can have public, static and final attributes.
That is, the properties in the interface can be defined as public static final int value=5;The interface separates the characteristics of the method and the implementation of the method. This separation is reflected in the fact that an interface often represents a role, which packages the operations and properties related to that role, and the class that implements this interface is the actor who plays this role. A role is played by different actors, and apart from playing a common role, different actors do not require anything else in common.Java interfaces (and abstract classes) are generally used as the starting point for a type hierarchy.
If a class already has a primary supertype, then by implementing an interface, the class can have another secondary supertype. This secondary supertype is called a mixed type.The above is the detailed content of Is java interface a class?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Zend Studio 13.0.1
Powerful PHP integrated development environment

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment





