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

What is the use of Getters and Setters method ?

Answer Posted / sumit bansal

you can put verification code in setter as if you want a
variable for storing weight you never want weight -ve So
write the code that prevent -ve entry of varible value in
setter method

Using getter and making your variable private you can be
sure that nobody can access it directly from outside.

Is This Answer Correct ?    31 Yes 19 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does sprintf allocate memory?

1116


What is the difference between jdk, jre, and jvm?

1120


What are dot operator queries?

1107


Why is static used?

1030


What is the final keyword denotes?

1112


Explain the scope of a variable.

1099


I want to re-reach and use an object once it has been garbage collected. How it's possible?

1030


What does snprintf return?

1005


How objects of a class are created if no constructor is defined in the class?

1072


Is null a value?

1043


Will minecraft java be discontinued?

1172


What is data string?

976


What are the six ways to use this keyword?

1061


When is the finally clause of a try-catch-finally statement executed?

1074


What is singleton class example?

1031