Practice Strings in Java
String manipulation, pattern matching, and text processing in Java.
Work through 19 exercises with starter code, expected output, test cases, and hints.
Strings exercises
- String Length Java exercise — Find the length of a string
- Convert to Uppercase Java exercise — Convert a string to uppercase
- Character at Index Java exercise — Get character at a specific position
- Extract Substring Java exercise — Extract a portion of a string
- Check Contains Java exercise — Check if a string contains a substring
- Replace Characters Java exercise — Replace parts of a string
- Reverse String Java exercise — Reverse a string
- String Palindrome Java exercise — Check if a string is a palindrome
- Count Vowels Java exercise — Count vowels in a string
- Count Words Java exercise — Count words in a sentence
- First Non-Repeating Character Java exercise — Find the first character that does not repeat
- Anagram Check Java exercise — Check if two strings are anagrams
- Longest Word Java exercise — Find the longest word in a sentence
- Remove All Spaces Java exercise — Remove all whitespace from a string
- Character Frequency Java exercise — Count frequency of each character
- String Compression Java exercise — Compress string using counts of repeated characters
- Alphabetical Character Frequency Java exercise — Count frequency of each character
- Remove Adjacent Duplicates Java exercise — Remove adjacent duplicate characters
- Zigzag Conversion Java exercise — Convert string to zigzag pattern
Browse the complete Java practice path · Open the online Java compiler