whst is encapsulation?when u encpsulate actually while
devoloping code?

Answer Posted / jag bhushan

Encapsulation means wrapping of data and the accessing
methods in one unit and hiding the data from outside world.
the data can be accessed only by using getter/setter method
so that no one can set a wrong value for a vriable. like
weight can not be less than zero. so if anyone want to set
the weight, it have to set only be using getter/setter.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the benefits of immutable objects?

535


How to sort numbers in java without array?

530


What is an i/o filter?

565


What is a blocking method in Java?

602


What is finally in Java?

577






What is a file pointer?

515


How can you add and remove nodes in jtree?

611


Can we sort list in java?

601


Write a function to print Fibonacci series and Tribonacci series?

757


What is difference between string and new string?

535


What is the difference between preemptive scheduling and time slicing?

590


Write a factorial program using recursion in java?

515


Which api is provided by java for operations on set of objects?

910


What is meant by class and object in java?

554


What is a flag variable?

557