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
what are the states associated in the thread? : Java thread
What is the do while loop syntax?
How do you check if a number is a perfect square?
What is arraylist e?
What is the significance of java packages?
What is the gregoriancalendar class in java programming?
Is array an object in java?
What is indexof in java?
Is a case study a method or methodology?
What are the different http methods?
Can java cast null?
What is the best definition for data?
What is the difference between a synchronized method and a synchronized block?
What is the right data type to represent a price in java?
What is the final keyword in java?