java.lang

ensureCapacity() StringBuffer Example

ensureCapacity() StringBuffer method gives guarantee the existing capacity. It behaves in two ways depending on the argument passed to the method. If the argument of the method is less than the existing capacity, then there will be no change in existing capacity (observe, sb1 in the example). If the argument is greater than the existing …

ensureCapacity() StringBuffer Example Read More »

Java Character getType() method Example

Many methods exist in java.lang.Character class used for different purposes. Some methods are useful for checking the character is a digit or letter or is a uppercase letter or lowercase letter etc. At the sametime, some methods can modify the case of the letters from uppercase to lowercase or vice versa. Now the present method …

Java Character getType() method Example Read More »

Java Character isWhitespace() method Example

Many methods exist in java.lang.Character class used for different purposes. Some methods are useful for checking the character is a digit or letter or is a uppercase letter or lowercase letter etc. At the sametime, some methods can modify the case of the letters from uppercase to lowercase or vice versa. Few more methods exist …

Java Character isWhitespace() method Example Read More »

Java Character isJavaIdentifierPart() Example

Many methods exist in java.lang.Character class used for different purposes. Some methods are useful for checking the character is a digit or letter or is a uppercase letter or lowercase letter etc. At the sametime, some methods can modify the case of the letters from uppercase to lowercase or vice versa. Few more methods exist …

Java Character isJavaIdentifierPart() Example Read More »

Java Character isLetter() method Example

Java Character API comes with many methods to test whether a character is a digit or letter etc. This type of testing is useful in situations like constraints on passwords, employee id etc. To test for letter, the character class comes with isLetter(char) method. Following is the method signature as defined in java.lang.Character class. public …

Java Character isLetter() method Example Read More »

Java Character toLowerCase() Example

Java Character API comes with many methods to convert a character’s type to another type. toLowerCase(char ch) converts uppercase ch letter to lowercase. After conversion, you can check the character is really converted or not with isLowerCase() method. If the character is already a lowercase one, it is returned as it is by the method. …

Java Character toLowerCase() Example Read More »

Java Character toUpperCase() Example

Java Character API comes with many methods to convert a character’s type to another type. toUpperCase(char ch) converts lowercase ch letter to uppercase. After conversion, you can check the character is really converted or not with isUpperCase() method. If the character is already an uppercase one, it is returned as it is by the method. …

Java Character toUpperCase() Example Read More »