answersLogoWhite

0


Best Answer

Yes, classes can implement more than one interface.

To declare a class that implements an interface, you include an implements clause in the class declaration.

Your class can implement more than one interface, so the implements keyword is followed by a comma-separated list of the interfaces implemented by the class.

By convention, the implements clause follows the extends clause, if there is one.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

yes an interface can extend multiple inerfaces,similar to class

eg. Interface Machine extends Pulley,Jack etc

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

Yes indeed

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Does the class can extend the class and implement interface at a time?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Can a class in java extend both abstract class and concrete class?

An Abstract class is similar to an interface. You cannot instantiate them, but you can extend them. Any class that extends the abstract class has to provide the implementation to the abstract methods. Hence these classes can be used as a skeleton to similar classes where some common functionality may be required. Such functionality can also be embedded into these classes. Unlike interfaces, abstract classes can have method code also. So they are very useful.


Why do you use interfaces in java?

An interface is used in java to outline specific behaviors of a group of classes, i.e. Comparable (able to be compared). These common behaviors translate into methods that are all public and unimplemented (since an interface lists what can be done not how). An interface is usually used when it doesn't make sense for something to be a class but it does have general behaviors that other classes should implement, i.e. there is not much sense to implement a Comparable class, since many different objects have vastly different ways to compare each other; thus, the behavior is outlined, and future classes can implement said behaviors (the methods).


What is an interface class and what is an abstract class?

The term interface class does not exist in C#. If this is a term describing a class being an interface to other component (human, subsystems, etc), it is very application specific. The designer of that application should know the abstraction.However, C# does have another type called interface. An interface is NOT a class. An interface defines the intention of some behaviors that classes may be extended it and provides the implementation. The intention, is nothing but method signatures, which defines the return data type, the method name, and any method arguments and associated data type. The implementation is the code of the method. Interface is used for separating the concern of design and implementation.Abstract class is a class with abstract keyword. It can be just like a class without that keyword (then, why it is an abstract class?). But it may have some methods or properties defined as abstract. These abstract methods, like the method signatures of an interface, defines the intention.The subclasses of such an abstract class would need to implement those abstract methods (providing the code).There are more common, differences between interfaces and abstract classes, please see answer(s) of those related questions in C# category.


What is serializable class in JAVA?

The serializable interface is used to perform the serialization action. Serialization is the process by which the contents of an object are written to any form of storage - say a flat file. This data stored in the flat file can be de-serialized at any time to create the object. Ex: public class Test implements Serializable { … //lots of code }


How are java threads created?

Thread can be created in two ways either by extending Thread or implementing runnable interface Examples: public class A extends Thread { } public class A implements Runnable { } By using both the methods we can create a Java Thread. The disadvantage of extending the Thread class is that, you cannot extend the features of any other class. If we extend the Thread class we cannot extend any other class whose features we may require in this class. So it is usually advisable to implement the Runnable Interface so that we can extend the required features and at the same time use the Thread functionality.

Related questions

Can a class in java extend both abstract class and concrete class?

An Abstract class is similar to an interface. You cannot instantiate them, but you can extend them. Any class that extends the abstract class has to provide the implementation to the abstract methods. Hence these classes can be used as a skeleton to similar classes where some common functionality may be required. Such functionality can also be embedded into these classes. Unlike interfaces, abstract classes can have method code also. So they are very useful.


Why do you use interfaces in java?

An interface is used in java to outline specific behaviors of a group of classes, i.e. Comparable (able to be compared). These common behaviors translate into methods that are all public and unimplemented (since an interface lists what can be done not how). An interface is usually used when it doesn't make sense for something to be a class but it does have general behaviors that other classes should implement, i.e. there is not much sense to implement a Comparable class, since many different objects have vastly different ways to compare each other; thus, the behavior is outlined, and future classes can implement said behaviors (the methods).


What is an interface class and what is an abstract class?

The term interface class does not exist in C#. If this is a term describing a class being an interface to other component (human, subsystems, etc), it is very application specific. The designer of that application should know the abstraction.However, C# does have another type called interface. An interface is NOT a class. An interface defines the intention of some behaviors that classes may be extended it and provides the implementation. The intention, is nothing but method signatures, which defines the return data type, the method name, and any method arguments and associated data type. The implementation is the code of the method. Interface is used for separating the concern of design and implementation.Abstract class is a class with abstract keyword. It can be just like a class without that keyword (then, why it is an abstract class?). But it may have some methods or properties defined as abstract. These abstract methods, like the method signatures of an interface, defines the intention.The subclasses of such an abstract class would need to implement those abstract methods (providing the code).There are more common, differences between interfaces and abstract classes, please see answer(s) of those related questions in C# category.


What is the need of interfaces while super classes are there?

Defining an Interface and implmenting it in Java is a security measure. An Interface limits how a Class can be modified and accessed. The security measure is there to prevent an object or user from accessing the superclass and changing an attribute or method that will effect how the class performs at run time or when compiling. The interface also clearly provides a blueprint to a user when implementing the functionailty of a the class. Yet another need for interfaces is when an a class cannot be initialized and needs a special implementation to be required which is accomplished with an Interface.


What is serializable class in JAVA?

The serializable interface is used to perform the serialization action. Serialization is the process by which the contents of an object are written to any form of storage - say a flat file. This data stored in the flat file can be de-serialized at any time to create the object. Ex: public class Test implements Serializable { … //lots of code }


How are java threads created?

Thread can be created in two ways either by extending Thread or implementing runnable interface Examples: public class A extends Thread { } public class A implements Runnable { } By using both the methods we can create a Java Thread. The disadvantage of extending the Thread class is that, you cannot extend the features of any other class. If we extend the Thread class we cannot extend any other class whose features we may require in this class. So it is usually advisable to implement the Runnable Interface so that we can extend the required features and at the same time use the Thread functionality.


Real time example for interface vs abstract class in java?

w.frnds........ I am just trying to an example of abstract class and interface class in real life . As these two ["interface class" is not a term in Java programming - just "interface"] classes [sic] are a concept of objest orientation so easy we can easily compare thhese with our real life . Suppose we have an abstract class called clark and an abstract method behabour of this abstract class ,which has no definition in abstract class. two other class security and receptionist inherits these clark class. So in thses two derived class there must has to be a defonation of behabour method,which depends on the derived class which types of behabour they will show........ So that is a real life example of Abstract class .Interface is also same as abstract class only the difference is it can't contain any implementation of any method in base class or super class. I think this is a sufficient example to understand abstract class and interface. [No, it is not sufficient.] If u have any doubt then u can contact me with this email id-rkmahanta26@gmail.com [Interfaces support multiple inheritance; classes do not. Interfaces contain only public members; classes do not have to. Interfaces do not have superclasses, except the implicit 'Object' supertype; they have superinterfaces. Nested interfaces are always static, never inner, unlike classes which can be inner classes. "u" is not an English pronoun. Use the tutorial and the JLS to understand interfaces and abstract classes, not this garbage answer.]


Extend the time on the remote?

You can use your remote to extend the run time of the remote start event.


How Can a derived class access an integer variable of base class in qt?

The best design strategy would be to provide a protected accessor (getter) that returns the variable either by value or by constant reference. If the derived class needs to mutate the variable, then provide a protected mutator (setter). Only derived classes have protected access to their base classes. However, derivatives can also lower that access to private with respect to their own derivatives, if desired. Even if the variable does not represent a class invariant, it's still best to provide an interface rather than expose an implementation detail outside of the class, whether that exposure is public or protected. In this way the implementation detail may be changed at a future time without affecting any of the consumers of your class (including derivatives), since they will all be using the public or protected interface. So long as that interface remains unchanged, the scope of your internal changes is limited to the class itself, thus you won't break any code that uses your class. If your class already provides a public interface to the variable, then your derived class can obviously make use of that as well. You only need a protected interface when no public interface is provided.


Why interface concept has been introduced in java?

An interface is a prototype for a class. The class may contains non-implemented method as well as no member variables (i.e. no variable declaration). The syntax for creating interfaces is :-interface interface_name{//statements}The syntex for implementing interfaces using "implements" keyword is :-class class_name implements interface_name{//statements}


Are you in run time when you design the user interface?

No, Design time


How do you extend concrete setting time?

you can buy primers from you local hardware or diy store to extend setting time