Explanation - As you can see the below code is the super class in one package as an API, and child class in another package, now what I want to do is access the value of "level" variable in child class.
The problem is the super class doesn't have any getters for the below mentioned variable as it contains only setters so when I am trying to access the value using child class it always give "Debug" as value.
However while debugging in eclipse it shows the original runtime value. How can I achieve that
public class CustomLogger {
protected String level = "Debug";
protected String category;
}
public class DisplayLogger extends CustomLogger{
public void childMethod(){
CustomLogger customLogger = someMethod(); // Return object at runtime
customLogger.level; // give compiletime error as is protected
System.out.println(this.level); // gives always "Debug" as output
}
}