why do we use interface in java?
Answers were Sorted based on User's Feedback
Answer / ki2
Hi, Here the Question is why do we use interface in java but
all people trying to say wat is an interface....
in software development ,We restrict the programmer to use
only those action wat we declare and these method
declarations are given to some third party vendors so they
can implemented their implementations.
Is This Answer Correct ? | 11 Yes | 1 No |
Answer / manasa
By default interface methods are abstract and public not
static methods
Is This Answer Correct ? | 10 Yes | 6 No |
Answer / guest
Interface is a collection of abstract classes n
methods.Interface is mainly used for restricting the users
to make use of the specified methods only.
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / navinice
We use Interfaces in java because JAVA Doesn't support
multiple inheritance. Thats why no any class can extend more
than one class in JAVA.. But through Interfaces we can
implement more than one interfaces and use there methods in
base class.
Is This Answer Correct ? | 6 Yes | 3 No |
Answer / sandeep sagala
Interface is used to get an 100% abstract class. By using
this class we cant create an object for this class. In this
there will be all the unimplemented methods only. No method
is implemented in this type of classes. The methods present
inside this interfaces are all static and public by default.
The attributes present inside this interfaces are public,
final and static by default.
Is This Answer Correct ? | 4 Yes | 11 No |
What are the advantages of passing this into a method instead of the current class object itself?
what is diff bet iterator and enumeration?
What is a singleton puppy?
Can a class be private?
How are commas used in the initialization and iteration parts of a for statement?
The following program is Overloading or Overriding? public class PolymorphismEx { public int sampleMethod(int a) { return a; } public String sampleMethod(int a) { return "Is it Overloading or Overriding???"; } }
4 Answers Ness Technologies, TCS,
what is the full form of java
Explain java code for recursive solution's base case?
What is meant by packages?
What is meant by event handling in SAX parser?
What is the frontend and backedn in Java?
Can a class have multiple constructors?