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 Encapsulation and Abstraction

Answer Posted / balbir

encapsulation:wraping of data and method into single unit.
e.g:

public class Test {
private int id;
private int roll;

public void method(int i,int j){
id = i;
roll = j;
System.out.println("===id==="+id);
System.out.println("===roll==="+roll);
}
public static void main(String args[])
{
Test t =new Test();
t.method(100,200);
}
}

in above example privatevariable wrap with public
method,this is encapsulation.

Abstraction:hiding the implementation details from the
external users.
e.g: electric switch board is available for end user
without knowing the implementation details.means end user
not bother about what is the manufactored items inside th
switch board.this is called abstraction.

Is This Answer Correct ?    12 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is nested class in java?

1099


Which collection is sorted in java?

981


What is a cup of java?

979


Define class?

976


Describe 2 different ways to concatenate two strings.

1144


What is array command?

1091


What are the wrapped, classes?

1006


What is the purpose of the main method?

945


Explain the importance of import keyword in java?

940


What do you mean Abstraction in java?

1037


What does it mean that a class or member is final?

939


What is nan in java?

941


What is covariant return type?

1056


Is void a return type?

902


What are variable names?

910