Java String Programs - 100 Practice Questions
Question 1: Write a Java program to reverse a string.
Explanation: Understand and practice the concept of 'reverse a string' using Java String methods.
Do not write the solution.
Question 2: Write a Java program to check palindrome.
Explanation: Understand and practice the concept of 'check palindrome' using Java String methods.
Do not write the solution.
Question 3: Write a Java program to count vowels.
Explanation: Understand and practice the concept of 'count vowels' using Java String methods. Do
not write the solution.
Question 4: Write a Java program to count consonants.
Explanation: Understand and practice the concept of 'count consonants' using Java String methods.
Do not write the solution.
Question 5: Write a Java program to count words.
Explanation: Understand and practice the concept of 'count words' using Java String methods. Do
not write the solution.
Question 6: Write a Java program to find duplicate characters.
Explanation: Understand and practice the concept of 'find duplicate characters' using Java String
methods. Do not write the solution.
Question 7: Write a Java program to remove duplicate characters.
Explanation: Understand and practice the concept of 'remove duplicate characters' using Java
String methods. Do not write the solution.
Question 8: Write a Java program to anagram check.
Explanation: Understand and practice the concept of 'anagram check' using Java String methods.
Do not write the solution.
Question 9: Write a Java program to toggle case.
Explanation: Understand and practice the concept of 'toggle case' using Java String methods. Do
not write the solution.
Question 10: Write a Java program to change to uppercase.
Explanation: Understand and practice the concept of 'change to uppercase' using Java String
methods. Do not write the solution.
Question 11: Write a Java program to change to lowercase.
Explanation: Understand and practice the concept of 'change to lowercase' using Java String
methods. Do not write the solution.
Question 12: Write a Java program to count frequency of characters.
Explanation: Understand and practice the concept of 'count frequency of characters' using Java
String methods. Do not write the solution.
Question 13: Write a Java program to replace spaces.
Explanation: Understand and practice the concept of 'replace spaces' using Java String methods.
Do not write the solution.
Question 14: Write a Java program to remove spaces.
Explanation: Understand and practice the concept of 'remove spaces' using Java String methods.
Do not write the solution.
Question 15: Write a Java program to extract initials.
Explanation: Understand and practice the concept of 'extract initials' using Java String methods. Do
not write the solution.
Question 16: Write a Java program to compare two strings.
Explanation: Understand and practice the concept of 'compare two strings' using Java String
methods. Do not write the solution.
Question 17: Write a Java program to lexicographical comparison.
Explanation: Understand and practice the concept of 'lexicographical comparison' using Java String
methods. Do not write the solution.
Question 18: Write a Java program to longest word.
Explanation: Understand and practice the concept of 'longest word' using Java String methods. Do
not write the solution.
Question 19: Write a Java program to shortest word.
Explanation: Understand and practice the concept of 'shortest word' using Java String methods. Do
not write the solution.
Question 20: Write a Java program to split string.
Explanation: Understand and practice the concept of 'split string' using Java String methods. Do not
write the solution.
Question 21: Write a Java program to reverse a string.
Explanation: Understand and practice the concept of 'reverse a string' using Java String methods.
Do not write the solution.
Question 22: Write a Java program to check palindrome.
Explanation: Understand and practice the concept of 'check palindrome' using Java String methods.
Do not write the solution.
Question 23: Write a Java program to count vowels.
Explanation: Understand and practice the concept of 'count vowels' using Java String methods. Do
not write the solution.
Question 24: Write a Java program to count consonants.
Explanation: Understand and practice the concept of 'count consonants' using Java String methods.
Do not write the solution.
Question 25: Write a Java program to count words.
Explanation: Understand and practice the concept of 'count words' using Java String methods. Do
not write the solution.
Question 26: Write a Java program to find duplicate characters.
Explanation: Understand and practice the concept of 'find duplicate characters' using Java String
methods. Do not write the solution.
Question 27: Write a Java program to remove duplicate characters.
Explanation: Understand and practice the concept of 'remove duplicate characters' using Java
String methods. Do not write the solution.
Question 28: Write a Java program to anagram check.
Explanation: Understand and practice the concept of 'anagram check' using Java String methods.
Do not write the solution.
Question 29: Write a Java program to toggle case.
Explanation: Understand and practice the concept of 'toggle case' using Java String methods. Do
not write the solution.
Question 30: Write a Java program to change to uppercase.
Explanation: Understand and practice the concept of 'change to uppercase' using Java String
methods. Do not write the solution.
Question 31: Write a Java program to change to lowercase.
Explanation: Understand and practice the concept of 'change to lowercase' using Java String
methods. Do not write the solution.
Question 32: Write a Java program to count frequency of characters.
Explanation: Understand and practice the concept of 'count frequency of characters' using Java
String methods. Do not write the solution.
Question 33: Write a Java program to replace spaces.
Explanation: Understand and practice the concept of 'replace spaces' using Java String methods.
Do not write the solution.
Question 34: Write a Java program to remove spaces.
Explanation: Understand and practice the concept of 'remove spaces' using Java String methods.
Do not write the solution.
Question 35: Write a Java program to extract initials.
Explanation: Understand and practice the concept of 'extract initials' using Java String methods. Do
not write the solution.
Question 36: Write a Java program to compare two strings.
Explanation: Understand and practice the concept of 'compare two strings' using Java String
methods. Do not write the solution.
Question 37: Write a Java program to lexicographical comparison.
Explanation: Understand and practice the concept of 'lexicographical comparison' using Java String
methods. Do not write the solution.
Question 38: Write a Java program to longest word.
Explanation: Understand and practice the concept of 'longest word' using Java String methods. Do
not write the solution.
Question 39: Write a Java program to shortest word.
Explanation: Understand and practice the concept of 'shortest word' using Java String methods. Do
not write the solution.
Question 40: Write a Java program to split string.
Explanation: Understand and practice the concept of 'split string' using Java String methods. Do not
write the solution.
Question 41: Write a Java program to reverse a string.
Explanation: Understand and practice the concept of 'reverse a string' using Java String methods.
Do not write the solution.
Question 42: Write a Java program to check palindrome.
Explanation: Understand and practice the concept of 'check palindrome' using Java String methods.
Do not write the solution.
Question 43: Write a Java program to count vowels.
Explanation: Understand and practice the concept of 'count vowels' using Java String methods. Do
not write the solution.
Question 44: Write a Java program to count consonants.
Explanation: Understand and practice the concept of 'count consonants' using Java String methods.
Do not write the solution.
Question 45: Write a Java program to count words.
Explanation: Understand and practice the concept of 'count words' using Java String methods. Do
not write the solution.
Question 46: Write a Java program to find duplicate characters.
Explanation: Understand and practice the concept of 'find duplicate characters' using Java String
methods. Do not write the solution.
Question 47: Write a Java program to remove duplicate characters.
Explanation: Understand and practice the concept of 'remove duplicate characters' using Java
String methods. Do not write the solution.
Question 48: Write a Java program to anagram check.
Explanation: Understand and practice the concept of 'anagram check' using Java String methods.
Do not write the solution.
Question 49: Write a Java program to toggle case.
Explanation: Understand and practice the concept of 'toggle case' using Java String methods. Do
not write the solution.
Question 50: Write a Java program to change to uppercase.
Explanation: Understand and practice the concept of 'change to uppercase' using Java String
methods. Do not write the solution.
Question 51: Write a Java program to change to lowercase.
Explanation: Understand and practice the concept of 'change to lowercase' using Java String
methods. Do not write the solution.
Question 52: Write a Java program to count frequency of characters.
Explanation: Understand and practice the concept of 'count frequency of characters' using Java
String methods. Do not write the solution.
Question 53: Write a Java program to replace spaces.
Explanation: Understand and practice the concept of 'replace spaces' using Java String methods.
Do not write the solution.
Question 54: Write a Java program to remove spaces.
Explanation: Understand and practice the concept of 'remove spaces' using Java String methods.
Do not write the solution.
Question 55: Write a Java program to extract initials.
Explanation: Understand and practice the concept of 'extract initials' using Java String methods. Do
not write the solution.
Question 56: Write a Java program to compare two strings.
Explanation: Understand and practice the concept of 'compare two strings' using Java String
methods. Do not write the solution.
Question 57: Write a Java program to lexicographical comparison.
Explanation: Understand and practice the concept of 'lexicographical comparison' using Java String
methods. Do not write the solution.
Question 58: Write a Java program to longest word.
Explanation: Understand and practice the concept of 'longest word' using Java String methods. Do
not write the solution.
Question 59: Write a Java program to shortest word.
Explanation: Understand and practice the concept of 'shortest word' using Java String methods. Do
not write the solution.
Question 60: Write a Java program to split string.
Explanation: Understand and practice the concept of 'split string' using Java String methods. Do not
write the solution.
Question 61: Write a Java program to reverse a string.
Explanation: Understand and practice the concept of 'reverse a string' using Java String methods.
Do not write the solution.
Question 62: Write a Java program to check palindrome.
Explanation: Understand and practice the concept of 'check palindrome' using Java String methods.
Do not write the solution.
Question 63: Write a Java program to count vowels.
Explanation: Understand and practice the concept of 'count vowels' using Java String methods. Do
not write the solution.
Question 64: Write a Java program to count consonants.
Explanation: Understand and practice the concept of 'count consonants' using Java String methods.
Do not write the solution.
Question 65: Write a Java program to count words.
Explanation: Understand and practice the concept of 'count words' using Java String methods. Do
not write the solution.
Question 66: Write a Java program to find duplicate characters.
Explanation: Understand and practice the concept of 'find duplicate characters' using Java String
methods. Do not write the solution.
Question 67: Write a Java program to remove duplicate characters.
Explanation: Understand and practice the concept of 'remove duplicate characters' using Java
String methods. Do not write the solution.
Question 68: Write a Java program to anagram check.
Explanation: Understand and practice the concept of 'anagram check' using Java String methods.
Do not write the solution.
Question 69: Write a Java program to toggle case.
Explanation: Understand and practice the concept of 'toggle case' using Java String methods. Do
not write the solution.
Question 70: Write a Java program to change to uppercase.
Explanation: Understand and practice the concept of 'change to uppercase' using Java String
methods. Do not write the solution.
Question 71: Write a Java program to change to lowercase.
Explanation: Understand and practice the concept of 'change to lowercase' using Java String
methods. Do not write the solution.
Question 72: Write a Java program to count frequency of characters.
Explanation: Understand and practice the concept of 'count frequency of characters' using Java
String methods. Do not write the solution.
Question 73: Write a Java program to replace spaces.
Explanation: Understand and practice the concept of 'replace spaces' using Java String methods.
Do not write the solution.
Question 74: Write a Java program to remove spaces.
Explanation: Understand and practice the concept of 'remove spaces' using Java String methods.
Do not write the solution.
Question 75: Write a Java program to extract initials.
Explanation: Understand and practice the concept of 'extract initials' using Java String methods. Do
not write the solution.
Question 76: Write a Java program to compare two strings.
Explanation: Understand and practice the concept of 'compare two strings' using Java String
methods. Do not write the solution.
Question 77: Write a Java program to lexicographical comparison.
Explanation: Understand and practice the concept of 'lexicographical comparison' using Java String
methods. Do not write the solution.
Question 78: Write a Java program to longest word.
Explanation: Understand and practice the concept of 'longest word' using Java String methods. Do
not write the solution.
Question 79: Write a Java program to shortest word.
Explanation: Understand and practice the concept of 'shortest word' using Java String methods. Do
not write the solution.
Question 80: Write a Java program to split string.
Explanation: Understand and practice the concept of 'split string' using Java String methods. Do not
write the solution.
Question 81: Write a Java program to reverse a string.
Explanation: Understand and practice the concept of 'reverse a string' using Java String methods.
Do not write the solution.
Question 82: Write a Java program to check palindrome.
Explanation: Understand and practice the concept of 'check palindrome' using Java String methods.
Do not write the solution.
Question 83: Write a Java program to count vowels.
Explanation: Understand and practice the concept of 'count vowels' using Java String methods. Do
not write the solution.
Question 84: Write a Java program to count consonants.
Explanation: Understand and practice the concept of 'count consonants' using Java String methods.
Do not write the solution.
Question 85: Write a Java program to count words.
Explanation: Understand and practice the concept of 'count words' using Java String methods. Do
not write the solution.
Question 86: Write a Java program to find duplicate characters.
Explanation: Understand and practice the concept of 'find duplicate characters' using Java String
methods. Do not write the solution.
Question 87: Write a Java program to remove duplicate characters.
Explanation: Understand and practice the concept of 'remove duplicate characters' using Java
String methods. Do not write the solution.
Question 88: Write a Java program to anagram check.
Explanation: Understand and practice the concept of 'anagram check' using Java String methods.
Do not write the solution.
Question 89: Write a Java program to toggle case.
Explanation: Understand and practice the concept of 'toggle case' using Java String methods. Do
not write the solution.
Question 90: Write a Java program to change to uppercase.
Explanation: Understand and practice the concept of 'change to uppercase' using Java String
methods. Do not write the solution.
Question 91: Write a Java program to change to lowercase.
Explanation: Understand and practice the concept of 'change to lowercase' using Java String
methods. Do not write the solution.
Question 92: Write a Java program to count frequency of characters.
Explanation: Understand and practice the concept of 'count frequency of characters' using Java
String methods. Do not write the solution.
Question 93: Write a Java program to replace spaces.
Explanation: Understand and practice the concept of 'replace spaces' using Java String methods.
Do not write the solution.
Question 94: Write a Java program to remove spaces.
Explanation: Understand and practice the concept of 'remove spaces' using Java String methods.
Do not write the solution.
Question 95: Write a Java program to extract initials.
Explanation: Understand and practice the concept of 'extract initials' using Java String methods. Do
not write the solution.
Question 96: Write a Java program to compare two strings.
Explanation: Understand and practice the concept of 'compare two strings' using Java String
methods. Do not write the solution.
Question 97: Write a Java program to lexicographical comparison.
Explanation: Understand and practice the concept of 'lexicographical comparison' using Java String
methods. Do not write the solution.
Question 98: Write a Java program to longest word.
Explanation: Understand and practice the concept of 'longest word' using Java String methods. Do
not write the solution.
Question 99: Write a Java program to shortest word.
Explanation: Understand and practice the concept of 'shortest word' using Java String methods. Do
not write the solution.
Question 100: Write a Java program to split string.
Explanation: Understand and practice the concept of 'split string' using Java String methods. Do not
write the solution.