Java help plez

So This program is supposed to shuffle a three world letter with an array so it displays the 3 possible letter combos. We are using the word cat. It doesn’t work. Help please?

import java.util.Scanner;
public class Unscramble{
public static void main(Stringargs){
System.out.println(“\f”);
Scanner input = new Scanner(System.in);
String word;
char letters;
char placeholder = new char[1];

    //Obtain word to scramble
    System.out.print("Enter a word to scramble: ");
    word = input.nextLine();
    letters =  word.toCharArray();
    
    //Scramble word
    for(int i = 0; i <= word.length(); i++){
        for(int j = 0; j <= word.length() - 1; j++){
            System.out.print(letters[j]);
            if(j == 2 && word.length() == 2){
                System.out.println(letters[0]);
            }else if(j == 3 && word.length() == 3){
                System.out.println(letters[0]);
            }
        }
        System.out.println();
        placeholder[0] = letters[0];
        if(word.length() == 2){
            letters[0] = letters[1];
            letters[1] = letters[2];
            letters[2] = placeholder[0];
        }else if(word.length() == 3){
            letters[0] = letters[1];
            letters[1] = letters[2];
            letters[2] = letters[3];
            letters[3] = placeholder[0];
        }
    }
   
    //cat;
    //tac;
    //act;
    //cta;
    //tca;
    //atc
    
    
}

}

you cant have an array that is 3 long and then access element number 3, that would technically be the fourth element in the array. computers are zero based index. so 0,1,2 is a three element array. so where you say that letters[2] = letters[3] it should be letters[2] = placeholder[0] you also made the same mistake in the 2 character long variant

Ya I didn't write this my partner did and he won't listen to me thats why I asked for help