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.

Answers were Sorted based on User's Feedback



Real Time sample code for Encapsulation and Abstraction. where to use abstract and where to use sp..

Answer / 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

Real Time sample code for Encapsulation and Abstraction. where to use abstract and where to use sp..

Answer / manikandan [ gtec,vellore ]

Encapsulation is used when v need to use a data with the
object access.
Abstraction is used when v need to restrict the end user to
access all process.

Is This Answer Correct ?    1 Yes 10 No

Post New Answer

More Core Java Interview Questions

where do we use init()

2 Answers  


Is main a keyword in java?

0 Answers  


Whats the difference between notify() and notifyall()?

0 Answers  


State the difference between creating string as new () and literal.

0 Answers  


what is singleton in java?

0 Answers   IBS,


Name the package that always imported by default?

4 Answers  


What is super keyword in java ?

1 Answers  


What is the difference between a method and a function in alice?

0 Answers  


Can we store variables in local blocks?

0 Answers   Global Logic,


i need to know the website that i can compile and run a java code in online.(while system doesn't contain any jdk and jre)

0 Answers  


Can you use abstract and final both with a method?

0 Answers  


What is a Hash Table? What are the advantages of using a hash table?

0 Answers   Ciena,


Categories