Page 2 of 2 FirstFirst 12
Results 21 to 22 of 22
  1. #21
    pringle is offline Member
    Join Date
    Jan 2008
    Rep Power


    Another thing, where i've written this:

    Case 2: if (!studentContactManager.isEmpty())
    System.out.println(“Contact Detail List”);
    For (int = 0; i < studentContactManager.length; i++);

    Am I correct in using 'studentContactManager.length' in order to display each stored contact?

  2. #22
    gibsonrocker800's Avatar
    gibsonrocker800 is offline Senior Member
    Join Date
    Nov 2007
    New York
    Rep Power


    yes because the .length attribute of arrays returns the number of elements in the array. and then, in the for loop, you do i < studentContactManager.length, in which it will iterate through each index of the array (and will never go out of bounds, because you did <. if you put <= it would throw an ArrayIndexOutOfBoundsException at runtime). So good job on that. I can see that you're learning =]

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Stuck on Two Questions, Please Help
    By sylo18 in forum New To Java
    Replies: 5
    Last Post: 03-11-2008, 02:03 AM
  2. 2 simple java questions
    By jimJohnson in forum New To Java
    Replies: 2
    Last Post: 02-02-2008, 10:35 AM
  3. questions
    By Gilgamesh in forum New To Java
    Replies: 3
    Last Post: 11-28-2007, 12:18 AM
  4. 3 Questions
    By hiranya in forum AWT / Swing
    Replies: 4
    Last Post: 11-14-2007, 05:57 AM

Posting Permissions

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