when,where and how to use abstract class and interface
Answer Posted / prapanch
if the developer wants some methods which are implemented
in the super class and some methods which will be
implementd by him then he will go for abstract class.
because in abstact class all methods need not to be abstact
in nature. but in interface all the methods must be
abstract and so the developer will not get any implemented
code from the interface. you will use interfaces when two
different teams are working for a same requirement then an
interface will act like a medium with which they can
interact and all the teams will be in line.so your team and
other team will implement the same method names but with
difffeerent implementation code.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What happens if constructor is private?
What is method overloading and method overriding?
Explain polymorphism citing an example.
Write a function to print Fibonacci series and Tribonacci series?
What is the difference between synchronized and synchronized block?
Can you write a java class that could be used both as an applet as well as an application?
How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters?
Which category the java thread do fall in?
what is the purpose of "virtual"?
How are variables stored?
What do you mean by of string::valueof expression in java 8?
What is hashmap in java?
What are the two basic ways in which classes that can be run as threads may be defined?
What is an iterator java?
What is meant by method overriding?