1String str = "India";
2System.out.println("last char = " + str.charAt(str.length() - 1));
1public class Test {
2 public static void main(String args[]) {
3 String string = args[0];
4 System.out.println("last character: " +
5 string.substring(string.length() - 1));
6 }
7}
1public class Test {
2 public static void main(String args[]) {
3 String string = args[0];
4 System.out.println("last character: " +
5 string.substring(string.length() - 1));
6 }
7}
8