what is the difference between abstract class and
Interface?where we can use it in realtime projects?

Answer Posted / nitesh

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 ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by mnemonics?

733


What is the static method?

726


Which is better stringbuilder or stringbuffer?

698


What are different types of expressions?

729


Can we override static methods in java?

789


What does microservices mean?

692


Where import statement is used in a java program?

791


What do you mean by flow of struts?

983


Which sort is best in java?

718


What is stack explain?

672


What is thread safe java?

681


What do you understand by garbage collection in Java? Can it be forced to run?

747


What is a literal coding?

711


What is a JAR file?

774


Explain the use of shift operator in java. Can you give some examples?

715