Java, Encapsulation, Programming, Software Development, Technology.
employee.setName("Vikram Gupta"); System.out.println("name : " + employee.getName() + " empId : " + employee.getEmpId()); } } Output: name : Vikram Gupta empId : 100 In this example, you can see that the variables of the class are declared as private so no other classes can access them directly