Ans. Encapsulation is a mechanism in Java that groups related data (attributes) and methods (behaviors) together into a single unit called a class. It provides data hiding, meaning that the internal representation and behavior of an object can be hidden from the outside world. This helps in achieving better modularity, maintainability, and reusability of code.