Java, Spring, Microservices, Interview, Coding.
= 3; // Error, cannot be accessed in subclass protectedVar = 4; // OK, can be accessed in subclass } } public class MyOtherClass { public void myOtherMethod() { MyClass obj = new MyClass(); // obj.privateVar = 5; // Error, cannot be accessed outside //the class // obj.protectedVar = 6; // Error,