Java, Spring, Microservices, Interview, Coding.
MyClass { private int privateVar; protected int protectedVar; public void myMethod() { privateVar = 1; // OK, can be accessed within the same class protectedVar = 2; // OK, can be accessed within the same class } } public class MySubclass extends MyClass { public void mySubMethod() { // privateVar