Shortcut to generate Getter and Setter in Eclipse

What are Getter and setter methods ? Getter method is to retrieve the value of instance variable while a setter method is used to set or update the value of instance variable. It is a good practice to access instance variables through these methods instead of directly accessing because we can place some pre-conditions before … Read more

stripTrailing() method of String class

stripTrailing() method has been introduced in String class of Java 11. It is used to remove all the trailing white space characters from the string and return the remaining string. It means it removes white spaces that come at the end of string. If the string only contains the white spaces then an empty string is returned. Let us … Read more

stripLeading() method in String class

stripLeading() method has been introduced in String class of Java 11. It is used to remove all the leading white space characters from the string and return the remaining string. It means it removes white spaces that comes at beginning of the string. If the string only contains the white spaces then an empty string … Read more

strip() method in String class

In Java 11 a new method strip() has been introduced in String class. It is used to remove all the trailing and leading white space characters from the string. strip() method returns the string after removing these white spaces. If the string only consists of white spaces then an empty string is returned. Let us … Read more