Remove left and right white spaces using Trim in JAVA

Remove left and right white spaces using Trim in JAVA

public class TrimWhiteSpaces {

    public static void main(String args[]) {
        String str = "    yami code    ".trim();
        System.out.println(str);
        // Output: "yami code"
    }

}