My answer: False I think it is this: Non-static inner classes cannot have non-final static members. Amy I thinking about this correctly? Or can anyone say this in a less confusing manner? Thanks, Jason
Marilyn de Queiroz
Sheriff
Joined: Jul 22, 2000
Posts: 9033
10
posted
0
Originally posted by Jason Stortz: True or False: Non-static inner classes cannot have static members?
Non-static inner classes cannot have non-final static members.
Inner classes cannot declare any static members unless they are compile-time constants and are primitives or Strings.
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Dean Jones Jr
Greenhorn
Joined: Mar 02, 2001
Posts: 6
posted
0
For simplicity your question can be modified as "inner classes cannot have static members" ? T/F (because inner classes means non-static nested classes) Inner classes are associated with the instance of the enclosing class. Hence, there cannot be static members in itself. However, as the sherrif said you can have compile time constants. --
Originally posted by Jason Stortz: [B]Take the following question:
My answer: False I think it is this: Non-static inner classes cannot have non-final static members. Amy I thinking about this correctly? Or can anyone say this in a less confusing manner? Thanks, Jason [/B]
Dean
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.