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 string is utf8?
What is a constructor overloading in java?
Can a class be defined inside an interface?
what is daemon thread and which method is used to create the daemon thread? : Java thread
What is a return in java?
Explain importance of finally block in java?
What is the synchronized method modifier?
What is use of map in java?
What is string pool?
Define jit compiler?
What is the static import?
How do you create a reference in java?
What does the “static” keyword mean?
What are the steps involved to create a bean?
Explain about map interface in java?