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
What is string syntax?
How do you ensure that n threads can access n resources without deadlock?
Can inner class be public in java?
What kind of variables a class can consist of?
Can we have any code between try and catch blocks?
How to create an immutable class?
What do you understand by copy constructor in java?
What are java threads?
What is static synchronization?
What is the relationship difference the canvas class and the graphics class?
What do you mean by chromounits in java8?
Does java arraylist maintain insertion order?
Can you access non static variable in static context?
Explain yield() method in thread class ?
What is sortedset in java?