can u give one sinario when you use Abstract Class and When
you use Interface.

Answer Posted / dhawal

when u want behavior of interface then u can implement that
inteface with any other class and after instantiate that
class u can get behavior of that interfce because by default
methods in interface are abstract,
But in case of abstract class u can not create object of
abstract class means you can not instantiate abstact class
but after extending or by creating base class pointer ,using
dynamic method dispatch u can get behavior of abstract class

Is This Answer Correct ?    5 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you stop a thread in java?

821


How does a for loop work?

745


what is heap memory?

855


What variables are stored in stack?

738


Can an interface extend another interface?

820


What is the size of int?

852


What is try-with-resources in java?

859


What are the two ways in which thread can be created?

821


what is the difference between future and callable interface in java?

880


Write a program in java to find the maximum and minimum value node from a circular linked list.

772


What is substring in java?

830


What is the use of keywords in java?

769


When arithmeticexception is thrown?

807


What is local variable and instance variable?

814


What is nan inf?

697