String Class in Java is most commonly used data type to Store sequence of characters and although it is not a primitive data type it is so closely available with Java Library that it’s as good as a primitive data type.
Although we have covered some basic details about String Class in Java, there will be instances in your programming project wherein you will have to do operations around String Class.
Following are some programming Questions and their Solutions related to String Class in Java.
- Write a Java Program to see if a String contains specific sequence of characters.
- Write a Java Program to manually compare one string to another string, without using any available method or == operator.
- Write a Java Program with methods to convert String into lowerCase of UpperCase.
- Write a Java Program to trim leading and training white-spaces form a java String.
- Write a Java Program to reverse characters of String.
- Write a Java Program to check if two Strings are Anagram to each other.
- Check if Java String is Numeric (Contain only Numbers)?
- Check if String is a palindrome.
- Write a Java program to print the count of each characters in the String, For example for String “sdfsdfsdfassss” answer will be a – 1, d-3, f-3, s-7