static classes

R

Roedy Green

Static classes are like inner classes, but you don't need a outer
instance.

Two questions:

1. Is anyone outside the enclosing class supposed to be able to
instantiate them?

2. If so, with what syntax.

I am trying to instantiate a JSpinner NumberModel static class.

the Language spec talks about the nested classes, but not how to
instantiate them.

While I am at it, are you supposed to be able to instantiate inner
classes outside the class they are defined?
 
D

David Zimmerman

Roedy said:
Static classes are like inner classes, but you don't need a outer
instance.

Two questions:

1. Is anyone outside the enclosing class supposed to be able to
instantiate them?
yes


2. If so, with what syntax.

Outer.Static foo = new Outer.Static();
I am trying to instantiate a JSpinner NumberModel static class.

the Language spec talks about the nested classes, but not how to
instantiate them.

While I am at it, are you supposed to be able to instantiate inner
classes outside the class they are defined?

Outer.Inner foo = new Outer().new Inner();

Since the inner class needs an instance of the outer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top