MyClass.java:5: error: name has private access in Person System.out.println(myObj.name); ^ 2 errors Instead, we use thegetName()andsetName()methods to access and update the variable: Example publicclassMain{pub
What is the main purpose of encapsulation in C++? To create multiple instances of a class To perform complex calculations within a class To ensure that sensitive data is hidden from users To increase code readability Submit Answer » Track your progress - it's free!