SpAm101's Profile User Rating: -----

Reputation: 11 Tradesman
Active Members
Active Posts:
54 (0.07 per day)
28-November 12
Profile Views:
Last Active:
User is offline May 09 2013 07:40 AM

Previous Fields

OS Preference:
Favorite Browser:
Favorite Processor:
Favorite Gaming Platform:
Your Car:
Who Cares
Dream Kudos:
Icon   SpAm101 has not set their status

Posts I've Made

  1. In Topic: Beginner Java Array Insertion Sort

    Posted 28 Mar 2013

    Hi again mushkyn

    The program is correct, you just have a semicolon where it shouldn't be:

    Make this:

    for(i=1; i<n; i++);


    for(i=1; i<n; i++)

    What was happening is the loop was completing by executing nothing, it was the same as doing this:

    for(i=1; i<n; i++)
    insert(x, i); 

    The loop continues until i is no longer less than n. This logically means i would be equal to n when the loop finishes. Normally this doesn't matter because the int used is declared only for the duration of the loop, but in your case, because of the semi-colon, you were accidently using the final value of 5.
  2. In Topic: Beginner Java Array Insertion Sort

    Posted 28 Mar 2013

    View PostGungnir, on 28 March 2013 - 02:49 AM, said:

    There's a DEBUG perspective, but I've always found that switching between perspectives just serves to confuse me even more. It's not particularly useful in the first place. I prefer custom logs.

    The OP can use whichever method.

    Each to their own of course. I simply suggest the debugger because it generally lets you see the state of local variables at the time of execution.

    The OP sticks a breakpoint on all the lines that are significant and where it could error out and they can see the value of x and j before the line even executes.

    View Postmushkyn, on 28 March 2013 - 02:55 AM, said:

    it displays: "java.lang.ArrayIndexOutOfBoundsException: 5".

    Then it's as Gungnir quite correctly said. You've got an array of size 5, so the indexes available are 0,1,2,3,4

    5 doesn't exist.

    View Postmushkyn, on 28 March 2013 - 02:55 AM, said:

    I'm not sure about the debugging tool, I haven't really covered how to use that yet but if you still think it would help with this, I will look into it.

    I'm not familiar with BlueJ I'm afraid, but if you Google it, i'm sure they'll be some tutorials.
  3. In Topic: Beginner Java Array Insertion Sort

    Posted 28 Mar 2013


    Whip up a quick debugger to check.

    Or preferably use the one already built into the IDE. If you're not using an IDE, then you should.

    If you're using netbeans, here's a quick tut on the debugging tool:


    You can Google for an eclipse one if you need.
  4. In Topic: Looping quirk

    Posted 18 Mar 2013

    Hi ngroebner

    Take a look at this SO thread:

  5. In Topic: Assignment question - deleting table row in servlet.

    Posted 15 Mar 2013

    Calling the doGet() method from doPost() is bad practice and goes against how HTTP works.

    You should response.sendRedirect instead to create a new GET request, which will call the doGet automatically.

My Information

Member Title:
D.I.C Head
23 years old
May 29, 1991
Norfolk, England
Full Name:
Years Programming:
Programming Languages:
HTML, CSS, Java, PHP, C#, C++, Javascript, SQL

Contact Information

Click here to e-mail me


SpAm101 hasn't added any friends yet.


SpAm101 has no profile comments yet. Why not say hello?