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

Hi.... I applied for the post of scientific officer/Engineer-SB(Programmer).Please post the syllabus and sample papers.

1763


What is treeset and treemap in java?

797


Write a java program to check if a number is prime or not?

762


Write a java program to find the route that connects between Red and Green Cells. General Rules for traversal 1. You can traverse from one cell to another vertically, horizontally or diagonally. 2. You cannot traverse through Black cells. 3. There should be only one Red and Green cell and at least one of each should be present. Otherwise the array is invalid. 4. You cannot revisit a cell that you have already traversed. 5. The maze need not be in the same as given in the above example

2334


What is thread start?

724


What do you mean Abstraction in java?

825


Is oracle charging for java?

782


What is gui programming?

726


How to split arraylist elements in java?

851


What type of variable is gender?

755


What is the difference between a method and a procedure?

764


Can we use different return types for methods when overridden?

770


What are the two types of java?

761


What is stack example?

780


Does every java program need a main?

767