Javas string class provides the following nonstatic methods
Solution
package org.students;
import java.util.Random;
 import java.util.Scanner;
public class JumbleLetters {
   public static void main(String[] args) {
        String word;
       
        // Scanner object is used to get the inputs entered by the user
        Scanner sc = new Scanner(System.in);
       
        //Getting the word entered by the user
        System.out.print(\"Enter a word :\");
        word = sc.next();
       //calling the method by passing user entered input as argument
        String jumbleStr = jumble(word);
       
        //Displaying the output
        System.out.println(\"The Output is :\" + jumbleStr);
}
   //This method will jumble the word and convert it into Upper case and return
    private static String jumble(String str) {
       
        //Declaring the variables
        char temp;
        int index;
        String jumbleStr = \"\";
       //Creating the random class obejct
        Random rand = new Random();
       
        //getting the random number
        index = rand.nextInt(str.length());
       
        //This loop will jumble the word
        while (str.length() != 0) {
            index = rand.nextInt(str.length());
            temp = str.charAt(index);
            str = str.substring(0, index) + str.substring(index + 1);
            jumbleStr += temp;
        }
        return jumbleStr.toUpperCase();
    }
}
__________________
output:
Enter a word :Holst
 The Output is :LHOTS
_________Thank You


