Search:

Type: Posts; User: Junky

Search: Search took 0.08 seconds.

  1. Thread: Jumble

    by Junky
    Replies
    4
    Views
    4,822

    Re: Jumble

    I should add that you would need to use substring to allow the code to be more flexible and handle Strings of any length.
  2. Thread: Jumble

    by Junky
    Replies
    4
    Views
    4,822

    Re: Jumble

    No you don't need a for loop.

    String text = "abcd";
    int index1 = 1; //change to be a random number
    int index2 = 2; //change to be a random number
    StringBuilder jumble = new StringBuilder();...
  3. Thread: Jumble

    by Junky
    Replies
    4
    Views
    4,822

    Re: Jumble

    Why are you using a for loop? Since the task only requires you to swap 2 chars then I would generate 2 random numbers. If those numbers are greater than 0, less than length - 1 and not equal to each...
Results 1 to 3 of 3