This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Java in General and the fly likes Nested interfaces for constants Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Nested interfaces for constants" Watch "Nested interfaces for constants" New topic
Author

Nested interfaces for constants

Ostin Night
Greenhorn

Joined: Feb 15, 2007
Posts: 7
Dear java community,

I had interface that have big amount of constants of different types:



I decided to create nested interfaces in this interface to collect similar constants in groups:



What do you think about this approach?

Thanks.


SCJP 5.0 (95%)
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Without context - I think there might be better ways, but we can't tell.

Perhaps interfaces, enumerations?

Or static final fields in User, Bank.
How much code uses these constants where and how?


http://home.arcor.de/hirnstrom/bewerbung
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Nested interfaces for constants
 
Similar Threads
Class or Interface
Unimplementable interfaces
Storing constants by shifting bits
Invalid argument: parameter index 1 is out of range
variavle declaration in interface