aspose file tools*
The moose likes Beginning Java and the fly likes Declaring an Object design Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Declaring an Object design" Watch "Declaring an Object design" New topic
Author

Declaring an Object design

Anthony Smith
Ranch Hand

Joined: Sep 10, 2001
Posts: 285
public static final int[][] roleOrderRank =
{
{SUPER_USER, 1},
{COMPANY_DEVELOPER, 2},
{COMPANY_ADMINISTRATOR, 2},
{USER_ADMINISTRATOR, 3},
{CONTENT_ADMINISTRATOR, 4},
{VENDOR_USER, 4},};
There is my code. It is in a class that is bascially full on constants. I want to be able to reference that 2D array. I know I have to use 2 for loops
but, how do I make it stop iterating b4 it goes out of bounds? I thought about using another kind of object container, but I want one I can use w/o having to instantiate the class...
please help.
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1817

Arrays are objects. One attribute of an array is its length attribute. Therefore, you need to use that in your condition.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Anthony Smith
Ranch Hand

Joined: Sep 10, 2001
Posts: 285
Thanks, that is exactly what I needed. However, could have declared the object using something besides an array? Can you declare a HashMap or some other object without trying to instantitating a class?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Declaring an Object design