StringBuffer strBuffer = new StringBuffer("Hello World"); strBuffer.deleteCharAt(5); System.out.println(strBuffer.toString());
StringBuffer strBuffer = new StringBuffer("Java is great"); strBuffer.deleteCharAt(0); System.out.println(strBuffer.toString());This code creates a new StringBuffer object with the value "Java is great". Then, it calls the deleteCharAt method to delete the first character (which is 'J'). Finally, it prints out the modified string. These examples use the StringBuffer class from the java.util package.