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
How many bits is a string?
What is java life cycle?
What is complexity and its types?
What is Enum in Java?
What is the difference between instanceof and isinstance?
What is set and get methods in java?
What is the role of garbage collector in java?
Who is founder of java?
What is the use of parse function in java?
What is difference between local variable and global variable?
Hi.... I applied for the post of scientific officer/Engineer-SB(Programmer).Please post the syllabus and sample papers.
What are the types of strings?
What is string in java? String is a data type?
Is there is any difference between a scrollbar and a scrollpane?
What are 3 data types?