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

What is method Overloading in the perspective of OOPS?

6 Answers  


Can we override data members in java?

0 Answers  


What is method and methodology?

0 Answers  


What do you mean by thread safe?

0 Answers  


write a program to create an arraylist with string(add,remove) operation.and value should be enter through keyboard.

0 Answers   Axcend,


Give any two differences between C++ and java.

0 Answers   GrapeCity,


Which is the best way to use for String concatenation in Java?

7 Answers   HCL,


Same common question what is Map,Set,HashMap,List????

4 Answers   Symphony,


What is yielding and sleeping? how they different?

2 Answers  


What is the benefit of inner / nested classes ?

0 Answers  


Can we use different return types for methods when overridden?

0 Answers  


Is arraylist dynamic in java?

0 Answers  


Categories