World 7 of 26 · Beginner

🔤 Strings & Text

13 Java concepts, each explained step by step with real code, a common trap and practice questions.

  1. String immutabilityMethods return new Strings; the original never changes.
  2. The String poolLiterals are interned; new String creates a separate object.
  3. == vs equals()== compares references; equals compares content; equalsIgnoreCase.
  4. Core String methodslength, charAt, substring, indexOf, contains, replace, trim/strip, isBlank, repeat.
  5. Comparing StringscompareTo lexicographic order and case sensitivity.
  6. Splitting & joiningsplit takes a regex; String.join and Collectors.joining.
  7. StringBuilderMutable builder: append, insert, reverse, deleteCharAt; why it beats + in loops.
  8. StringBuilder vs StringBufferStringBuffer is synchronized and legacy.
  9. Formatting textString.format, formatted(), printf format specifiers %d %s %.2f %n.
  10. Text blocksTriple-quoted multi-line strings and incidental indentation.
  11. chars, Character & code pointsCharacter.isDigit/isLetter, toUpperCase, emoji as surrogate pairs.
  12. Converting to and from StringsString.valueOf, toString, Integer.parseInt, NumberFormatException.
  13. Null-safe string handling"literal".equals(x), Objects.equals, isEmpty vs isBlank.