Here is the code that we wrote today:

    boolean isTextFile(String filename) {
        //find last 4 characters
        int len = filename.length();
        if(len < 4) {
            return false;  //string too short to end in .txt
        }
        String ending = filename.substring(len-4);
        
        //see if they're equal to .txt
        return ending.equals(".txt");
        
        //don't work:
        //return (filename.indexOf(".txt") != -1);
        //return (filename.indexOf(".txt") == filename.length()-4);
    }
    
    String helloName(String name) {
        return "Hello " + name + "!";

        //String greeting = "Hello " + name + "!";
        //return greeting;
    }

    boolean prefixAgain(String str, int n) {
        //extract prefix
        String prefix = str.substring(0,n);
        String rest = str.substring(n);
  
        //look for prefix in string
        return (rest.indexOf(prefix) != -1);
    }

    String makeAbba(String a, String b) {
        return a + b + b + a;
    }