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

What are encapsulation, inheritance and polymorphism?

941


What is a parameter used for?

913


explain what is transient variable in java?

1060


What are the differences between heap and stack memory?

1019


What is instance synchronization?

998


What comes to mind when someone mentions a shallow copy in java?

1061


What is abstract class? Explain

975


Is an integer an object?

901


What is string english?

958


what are the high-level thread states? : Java thread

948


how does multithreading take place on a computer with a single cpu? : Java thread

1081


Is java written in c?

911


What is meant by main method?

997


What is not object oriented programming?

873


What is a package in java? List down various advantages of packages.

1195