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

what are the states associated in the thread? : Java thread

998


What is the do while loop syntax?

979


How do you check if a number is a perfect square?

938


What is arraylist e?

1019


What is the significance of java packages?

1065


What is the gregoriancalendar class in java programming?

971


Is array an object in java?

904


What is indexof in java?

939


Is a case study a method or methodology?

848


What are the different http methods?

976


Can java cast null?

978


What is the best definition for data?

923


What is the difference between a synchronized method and a synchronized block?

1015


What is the right data type to represent a price in java?

910


What is the final keyword in java?

1348