证明某字母是否最后一个字母

public class SuLie {
    public static void main(String[] args){
        String str1="adjklasjfkdlsafj";
        int x=str1.lastIndexOf("j");
        if(x+1==str1.length()){
            System.out.println("j是最后一个字母");
        }
        else{
            System.out.println("j不是最后一个字母");
        }
    }
    
    
}

原文地址:https://www.cnblogs.com/shark1100913/p/5052958.html