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


Please Help Members By Posting Answers For Below Questions

How do you add spaces in java?

705


What is java literals?

753


What does the “final” keyword mean in front of a variable? A method? A class?

741


What is static method with example?

841


Can a class have more than one object?

723






What is meant by data hiding in java?

819


Can static methods be inherited?

740


What is meant by overloading?

778


What modifiers may be used with a top-level class?

761


What is the char data type?

750


What is anti pattern in cyber security?

714


How many types of keywords are there?

736


What is double checked locking in singleton?

787


Why isn’t there operator overloading?

783


What is the difference between equals() and == in java?

674