Results 1 to 2 of 2

Thread: Array output

  1. #1
    lowziqian is offline Member
    Join Date
    Nov 2011
    Rep Power

    Default Array output

    edit: sorry i solved it. thx
    Last edited by lowziqian; 12-01-2011 at 08:11 AM.

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    New Zealand
    Rep Power

    Default Re: Array output

    As you scan the input update a counter so that you know how much "good" data has been entered. Use this count when you want to output or manipulate the data.


    Don't create a new instance of Scanner each time around a for loop. The for loop "for(int i=0;i;i++) {" won't compile.

    In general, don't rush into code. Think about *how* you will read/store/output the data and on that basis write the code. If you think in terms of "how would I rather than the computer..." then the idea of keeping a counter appears quite naturally, and the idea of using a new pair of eyes/brain to scan the input for each new element seems unnatural.

Similar Threads

  1. help! shapes output and array issues!
    By japgoth in forum New To Java
    Replies: 2
    Last Post: 01-25-2011, 09:49 PM
  2. problem with output from Array
    By nellyman in forum New To Java
    Replies: 5
    Last Post: 01-25-2011, 05:41 PM
  3. Help with Array output Needed!
    By 2potatocakes in forum New To Java
    Replies: 2
    Last Post: 03-07-2009, 06:36 PM
  4. output from an array
    By in forum New To Java
    Replies: 5
    Last Post: 08-15-2008, 08:26 AM
  5. JSP to output Java String Array
    By irenavassilia in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 03-31-2008, 04:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts