Hi@akhtar,
You can use the StringBuffer class. It provides a method deleteChartAt(). The method deletes a character from the specified position. We use the method to remove a character from a string Java. It accepts a parameter index of type int. The index is the position of a character we want to delete.
public class RemoveLastCharcter1
{
public static void main(String args[])
{
String string = "I am learning Java Concepts";
//creating a constructor of StringBuffer class
StringBuffer sb= new StringBuffer(string);
//invoking the method
sb.deleteCharAt(sb.length()-1);
//prints the string after deleting the character
System.out.println(sb);
}
}