What does .equals() not work : I printed the 2 strings and they are literally identical, no whitespaces cause i replaced it.
https://ideone.com/cw07LG 
Here it is compiled

   

     public class Palindrome{
        public static boolean isPalindrome(String word){
            int length;
            String oppositeWord ="";
            word = word.replace(" ","");
            word = word.toLowerCase();
            length = word.length();
    
            for(int i=length-1;i>=0;i--){
                if(Character.isLetter(word.charAt(i))){
                    oppositeWord +=word.charAt(i);
                }else{
                    word = word.replace(word.charAt(i),'\0');
                }
                
            }
            System.out.println(oppositeWord);
            System.out.println(word);
            
            return oppositeWord.equals(word);
            
        }
    
        public static void main(String[]args){
            System.out.println(isPalindrome("Madam, I'm Adam"));
        }
    }