1String s = "Hello Worlds";
2String end = "";
3end = s.substring((0, s.length()-1));
1private static String removeLastChar(String str) {
2 return str.substring(0, str.length() - 1);
3}
1String str = "India";
2System.out.println("last char = " + str.charAt(str.length() - 1));
1import java.util.*;
2class LastCharRemove
3{
4public static void main(String str[])
5{
6Scanner sc=new Scanner(System.in);
7String str1=sc.nextLine();
8int n=str1.length();
9StringBuilder b= new StringBuilder();
10b.append(str1);
11b.delete(n-1,n);
12System.out.println(b.toString());
13}
14}