Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Difference between interface and abstract class with ex.

Answer Posted / vinoth sing

abstract class contain both abstract and non abstract methods
vs
interface can have only abstract methods.

a class implementing a interface itself a abstract class.

eg for interface

interface shape2d
{
double getArea();
}

class circle implements shape2d
{
int radius;
public double getArea()
{
return math.pi*r*r;

}
circle(int radius)
{
this.radius=radius;
}
class circledemo
{

public static void main (string args[])
{
circle c= new circle(10);
system.out.println(c.getArea());
}

}

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the five major types of reference sources?

1038


What does replaceall do in java?

869


Differece between class and generic class?

974


What is == mean?

932


Can a class extends itself in java?

968


Garbage collection in java?

950


What are different types of classloaders?

977


What is the difference between scrollbar and scrollpane?

1044


what do you mean by marker interface in java?

924


What are the important features of Java 11 release?

1053


What is the destroy method?

994


Explain about interthread communication and how it takes place in java?

960


What is the purpose of the finalize() method?

1174


Explain the difference between throw and throws in java?

946


What is instance means in java?

991