Re: About Question enthuware.ocpjp.v7.2.1243 :
Posted: Tue Jan 09, 2018 7:49 pm
Tried and it is correct only for class fields. Methods are class members as well but they cannot be declared as static. So, is it correct statement saying that inner class can have static members?
Example:A non static inner class may have static members.
Code: Select all
public class Outer {
class Inner {
static final int i = 0; // fine
static final void print() { // compile error
System.out.println("Inner static method");
}
}
}