Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Page 2 of 2 FirstFirst 12
Results 26 to 28 of 28

Thread: 3 Arrays

  1. #26
    Junior Member
    Join Date
    Jun 2011
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: 3 Arrays

    lab3tester.jpg

    lab3tester.jpg



    As showed above, Default constructor and default constructor with given size gives OK. But when I run the iterator, nothing is shown for the output.

  2. #27
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,150
    Thanks
    48
    Thanked 2,158 Times in 2,131 Posts

    Default Re: 3 Arrays

    nothing is shown for the output.
    You need to add some println debugging code to see where the execution flow goes and what the values of the variables are as they are used and change. From your desk checking with paper and pencil you should know what the variables' values should be at each step so you can compare the printed output with what you expect the values to be and determine what is wrong with the code.

  3. #28
    Forum old-timer
    Join Date
    Nov 2008
    Location
    Faversham, Kent, UK
    Posts
    471
    My Mood
    Mellow
    Thanks
    4
    Thanked 58 Times in 54 Posts

    Default Re: 3 Arrays

    When I run your iterator, it works OK - although because the list acts more like a stack if you use insertItem, so the items I inserted came out of the iterator in reverse order of insertion.

    I have to say that this 'SimpleComparableList' doesn't seem all that simple to me - the insertItem method seems counter-intuitive, and the currentPosition idea is a confusing complication - next() and prev() don't return the next and prev items, although the iterator next() does return the next item... YMMV.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. 2d arrays help
    By gonfreecks in forum What's Wrong With My Code?
    Replies: 0
    Last Post: November 27th, 2010, 04:27 PM
  2. arrays
    By dwamalwa in forum Java Theory & Questions
    Replies: 4
    Last Post: November 27th, 2010, 12:44 AM
  3. Help with Character arrays
    By shanklove in forum What's Wrong With My Code?
    Replies: 6
    Last Post: September 6th, 2010, 12:56 PM
  4. Arrays
    By mlan in forum Java Theory & Questions
    Replies: 2
    Last Post: February 26th, 2010, 09:23 AM
  5. 2d Arrays
    By mgutierrez19 in forum Collections and Generics
    Replies: 5
    Last Post: October 27th, 2009, 04:08 PM