what is difference between abstract and interface?
can i give real time example for the two topics?

Answer Posted / srinu

interface:interface contain only undefined methods

Abstract: Abstract class contain some undefined methods 0r
some defined methods or all defined methods.

Ex: Real time Example
interface Father
{
public void studyDaily();
public void dailyGotoCollege();
}
Abstrct class Son implements Father
{
public Void studyDaily();---->But his son didnot Study
daily he does n't interet Daily

public void dailyGotoCollege()
{
System.out.println("yes Father I go to college");
}
}

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you add an element to an arraylist in java?

481


What is exception hierarchy in java?

583


How many return statement are allowed in a function?

453


Which collection does not allow duplicates in java?

462


What is tostring () method?

535






What are the practical benefits, if any, of importing a specific class rather than an entire package (e.g. Import java.net.* Versus import java.net.socket)?

586


What is classname class in java?

528


Is nullpointerexception checked or unchecked?

549


If you are given the name of the function at run time how will you invoke the function?

676


What is the size of int in 64-bit jvm?

547


Can java list contain duplicates?

574


What is finalize()? Is finalize() similar to a destructor?

536


What is procedure overloading?

1796


How do I remove a character from a string in java?

494


What carriage return means?

524