Commit 068e82a
committed
feat: Convert string to char array and modify first character
🔍 What this code does:
- Takes the string `"hello"` and converts it to a character array using `toCharArray()`.
- Modifies the first character (`'h'`) to `'j'`.
- Reconstructs a new string from the modified array.
- Prints the result: `"jello"`.
✅ Why:
This approach demonstrates how to modify specific characters in a string since strings in Java are immutable.
Signed-off-by: Somesh diwan <[email protected]>1 parent 857698e commit 068e82a
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
9 | 13 | | |
10 | 14 | | |
0 commit comments