Check out example codes for "java get last char of string". It will help you in understanding the concepts better.

Code Example 1

public class Test {
    public static void main(String args[]) {
        String string = args[0];
        System.out.println("last character: " +
                           string.substring(string.length() - 1)); 
    }
}

Code Example 2

String str = "India";
System.out.println("last char = " + str.charAt(str.length() - 1));

Learn ReactJs, React Native from akashmittal.com