Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java Array initialization

807603Feb 7 2008 — edited Feb 7 2008
I am in a Java class and one of the problems that we have been given as homework is stumping me. It wants us to use a stack containing int triples ( i, j, k ) to initialize n values of an n X n array. The trick is that we can't initialize the array normally ( int[][] A = new int[n][n] ) because we don't want a *O[n^2^]*.

My question is, how can I create an n X n array without setting the initial values to zero and still be able to use it in the program?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 6 2008
Added on Feb 7 2008
9 comments
1,652 views