IN java collections we have both interfaces and classes.
instead of using interfaces why we can't use classes only
like that why we can't use interfaces only. why we need two
things interface and class.
Answer Posted / sarath
Both of them have different purpose.
A Class have state(Fields) and behaviour(Methods). But in Interface we are telling a common behaviour.
for example I have a class called ABCBycycle.java . It implements some common behaviour of bycyle from Bycycle interface,
by implementing the Bycycle interface we are telling that ABCBycycle.java have some common behaviour of bycyle.
So iterface not the blue print of state and behaviour.
But Class is the blue print of some state and behaviour
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How will you reverse a link list without using recursion?
Define array. Tell me about 2-D array.
How do you convert an int to a string in java?
Explain a situation where finally block will not be executed?
What are methods in java?
When should I use stringbuffer?
What is java beans?
What are computer functions?
What is the importance of hashcode() and equals() methods?
What are the steps involved to create a bean?
What is the use of java?
What is the use of set in java?
What is variable explain?
How much is a java license?
What is hashing principle in java?