Search:

Type: Posts; User: Norm

Search: Search took 0.53 seconds.

  1. Thread: Sorting issues.

    by Norm
    Replies
    16
    Views
    1,788

    [SOLVED] Re: Sorting issues.

    I made a slight change to the data and the order of the sorts and now none of them work.



    public static void main(String [] args) {
    hardware.add( new Item("100", "Air Filters", ...
  2. Thread: Sorting issues.

    by Norm
    Replies
    16
    Views
    1,788

    [SOLVED] Re: Sorting issues.

    Adding printlns will show you what is going on. If you have worked out the logic with paper an pencil, the print outs will show you what the code is doing so you can understand what the computer sees...
  3. Thread: Sorting issues.

    by Norm
    Replies
    16
    Views
    1,788

    [SOLVED] Re: Sorting issues.

    Add printlns to show what the args to compareTo() are and what it returns.
    Or write some simple test code like this with several different values: System.out.println("asdd".compareTo("xxx"));
  4. Thread: Sorting issues.

    by Norm
    Replies
    16
    Views
    1,788

    [SOLVED] Re: Sorting issues.

    Try debugging the sort method by adding println statements to it that print out the values of the variables and shows the execution flow. The print out will show you what the computer sees and help...
  5. Thread: Sorting issues.

    by Norm
    Replies
    16
    Views
    1,788

    [SOLVED] Re: Sorting issues.

    It's not a bug. Its the way tab characters work. tabs are NOT a reliable way to format output unless you can set where they are defined to be. I don't know how to set tabs for the console.

    If...
  6. Thread: Sorting issues.

    by Norm
    Replies
    16
    Views
    1,788

    [SOLVED] Re: Sorting issues.

    Post the output as text that can be copied and pasted into other posts. Can't do that with images.
    Also can you add comments the parts you are talking about.
  7. Thread: Sorting issues.

    by Norm
    Replies
    16
    Views
    1,788

    [SOLVED] Re: Sorting issues.

    Please post the output that shows what you are talking about
  8. Thread: Sorting issues.

    by Norm
    Replies
    16
    Views
    1,788

    [SOLVED] Re: Sorting issues.

    On line on 79 the index you are using went past the end of the array. Check your logic to keep the index in bounds.
    Remember the indexes for arrays start at 0 and go to the array length-1.
    ...
Results 1 to 8 of 8