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...

Real Time sample code for Encapsulation and Abstraction.
where to use abstract and where to use specifies like
public private.

Answer Posted / ravikiran

Encapsulation & Abstraction:

The private variable declaration is abstration,and making
usage of getters and setters is encapsulation

private String name="";
private String school="";

public String getName()
{
return name;
}

public void setName(String name)
{
this.name=name;
}

When We use private when we want to restrict the access
within the class.

When we use public then the variable or method will be
accessible in all the locations

Is This Answer Correct ?    18 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why are there no global variables in java?

1044


Where are the card layouts used?

1062


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

1041


What are the types of exceptions?

1054


What are the uses of synchronized keyword?

1001


What is the core java?

948


How do you sort an array in java?

990


What does you mean in math?

1082


What is the point of polymorphism java?

1009


How does list work in java?

912


How does remove work in java?

968


Can you call a method in a method?

1087


What is a function argument in java?

991


What is an inner class in java?

965


What is a vararg?

1031