trim first and last character java code example Example: java remove first character "Hello World".substring(1) // ello World