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

23. Storage space in java is of the form Stack Queue Heap List 24. What is java code embedded in a web page known as Applets Servlets scriptlets snippets 25. Which of the following attributes are compulsory with an tag?. code,height & width. 26. What does 'CODEBASE' in an applet tag specify?. Files absolute path.

2283


How to store image in arraylist in java?

743


What best practices should you follow while writing multithreaded code in java?

803


What are drawbacks of singleton class?

748


Define nashorn in java8.

820


What is type conversion in java?

815


How do you check if an arraylist is not empty?

828


Is array serializable java?

752


Can we have this () and super () together?

818


Can we override constructors in java?

893


Can we write a class without main method in java?

713


Write a method to check if input string is palindrome?

805


What is the main use of generics in java?

744


What is the default value of the local variables?

742


What is the Scope of Static Variable?

989