The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
September 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

modify?

Posted by Chin Loong on September 27, 2001 at 3:46 AM

hmm.. i think that grasping the basics and writing your own's from scratch is much better than changing a one-dimensional array function into a two-dimensional array function in this case since it's quite simple.. ;)

public void displayItem(){

display.removeAll();

if (counter1<0 || counter2<0){
// i don't know how u keep track of your counters, but if u want
// it to be two-dimensional, u better keep track of it properly
// when counter2==max, set counter1++ and counter2=0
display.add("No record in the array.");
}
else
{
for(int i=0;i<=counter1;i++)
for(int j=0;j<=counter2;j++)
display.add(purchase[i][j].getAll());
}
}

still, i think that using Vector to keep track is much easier than using arrays.. what do u guys think?



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us