fork(140) download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. public class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. String s1 = "Remove Last CharacterY";
  9. String s2 = "Remove Last Character2";
  10. System.out.println("After removing s1==" + removeLastChar(s1) + "==");
  11. System.out.println("After removing s2==" + removeLastChar(s2) + "==");
  12. }
  13.  
  14. private static String removeLastChar(String str) {
  15. return str.substring(0,str.length()-1);
  16. }
  17. }
Success #stdin #stdout 0.02s 245632KB
stdin
Standard input is empty
stdout
After removing s1==Remove Last Character==
After removing s2==Remove Last Character==