J
joes
Hello Gurus
I have a question. I have a class which holds an inner class declared
"private static". This inner class has a static field which is
immediately initilaized. When gets this static initilaziation of a
private static class exectuted?
- does it get executed when the outer class is loaded?
- does it get only executed if the inner class is getting loaded?
Example:
------------
public class Log {
private static class LoggerHolder {
public static Logger sLogger =
LoggerHelper.getLogger(LOGGER_CLASS);
}
public static Logger getLogger() {
return LoggerHolder.sLogger;
}
}
many thanks
regards
Mark
I have a question. I have a class which holds an inner class declared
"private static". This inner class has a static field which is
immediately initilaized. When gets this static initilaziation of a
private static class exectuted?
- does it get executed when the outer class is loaded?
- does it get only executed if the inner class is getting loaded?
Example:
------------
public class Log {
private static class LoggerHolder {
public static Logger sLogger =
LoggerHelper.getLogger(LOGGER_CLASS);
}
public static Logger getLogger() {
return LoggerHolder.sLogger;
}
}
many thanks
regards
Mark