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 is a percentage sign called?

1100


Can a class be protected in java?

948


Can we able to pass objects as an arguments in java?

1003


Why hashcode is used in java?

949


What is bifunction in java?

1167


What are constants?

1039


What is a arraylist in java?

1042


What are the types of web technologies?

1032


What is bigger kb or mb?

1022


Can we override private constructor in java?

954


What is meant by inheritance and what are its advantages?

1084


Can we call a non-static method from inside a static method?

985


What is meant by 'bit masking' in java?

1171


Explain when classnotfoundexception will be raised ?

1021


Difference between error and exception

6008