Commit ed7637f
committed
feat: Demonstrate array mutability by modifying array through function call
🧠 Logic:
- Passes an array `nums` to a method `change`.
- The method modifies `arr[0] = 99`.
- Since arrays are reference types in Java, the original array is modified.
- Prints the array before and after the change to illustrate the effect.
📌 Highlights that Java passes object references by value, so modifications inside functions affect the original array.
Signed-off-by: Somesh diwan <[email protected]>1 parent 62cbbc6 commit ed7637f
1 file changed
+1
-1
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
0 commit comments