why interfaces are faster than abstract classes?
Answers were Sorted based on User's Feedback
Answer / aruna raman
Actually abstract are faster than interfaces classes.
interfaces are Slow, requires extra indirection to find the
corresponding method in the actual class. Modern JVM's are
discovering ways to reduce this speed penalty.
Abstract Class ::
- It cannot defines all the methods
- It has subclass.
- Here, Subclass is useless
- A class can be extend an abstract class
Interface ::
- It defines all the methods
- It must have implementations by other classes, But there
will be no use of that.
- Only an interface can extend another interface.
| Is This Answer Correct ? | 16 Yes | 3 No |
Answer / laxmikant
As Interfaces always have abstract methods, it needs less
time for compiler to compile them as compared to abstract
classes which may have well defined methods for sharing
among the classes which will extend it.
| Is This Answer Correct ? | 4 Yes | 16 No |
Answer / m gangadhar
using interfaces over abstract classes is gives better
ferformance becoz interfaces does not have any constructor
but abstract classes can have. for this reason it does not
vaste time to create object.
| Is This Answer Correct ? | 11 Yes | 29 No |
what is the output ? Math.floor(-2.1) a)2 b)-2 c)-3.0 d)0
Name the method that is used to set a TextComponent to the read-only state?
Why do we need data structure in java?
What is inner class?what is the use of inner class?where we create the object for inner class? and inner class can extend any class or inner class can implement any interface?
What are void methods?
What is a parameter used for?
Which of the following is not an isolation level in the JDBC
Why parsing is done?
If your team member writes code with lots of static variables and static methods, will it cause any side effects?
What is the technique adopted to create an immutable class?
Is hashset ordered?
What are different types of access modifiers?