what is the difference between abstract class and
Interface?where we can use it in realtime projects?
Answer Posted / sudhakar
1)We define an Interface in the Java application with a
set of abstract methods without any implementation. Which
means all the methods of an interface are by default
abstract methods and public methods.
2)Once an Interface is defined in the application then any
class can implement that interface, in such case the class
must be implemented with all the mehtods of the respective
Interface otherwise the class will become as abstract class.
3)A class can implement any no. of interfaces, in such case
the class must be implimented with all the methods of those
interfaces otherwise the class will become as abstract class
| Is This Answer Correct ? | 125 Yes | 25 No |
Post New Answer View All Answers
Why declare Main() inside the class in java ?
What causes memory leak in java?
How to create a thread in java?
Explain creating threads by implementing runnable class?
Why are parameters used in functions?
What is meant by final class?
What is identifier in java?
List some java keywords sun like c, c + + keywords?
Explain hashset and its features?
What is the java reflection api? Why it’s so important to have?
Can a static block throw exception?
How is garbage collection controlled?
Is int primitive data type?
What is fail fast in java?
Give an example of use of pointers in java class.