Commit 9fd2634
committed
feat: Explain constructor limitation in initializing static variables with usage examples and best practices [static-init-explained]
📌 Highlights:
- Demonstrates how static variables are class-level and initialized at class load time.
- Shows why constructors are only suitable for instance variables.
- Includes examples of direct static initialization and static blocks.
- Emphasizes correct usage patterns for global vs object-specific data.
Signed-off-by: Somesh diwan <[email protected]>1 parent 7fc8b38 commit 9fd2634
File tree
1 file changed
+2
-1
lines changed- Section10Methods/LocalandGlobalVariables/src
1 file changed
+2
-1
lines changedLines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
60 | | - | |
| 61 | + | |
0 commit comments