Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
Malware / Trojaner / VirenThis month in security with Tony Anscombe – September 2026 edition(30.09.2026 um 10:00 Uhr)
•
Linux Tipps & HardeningHere's the top 50 most played games on Steam Deck for September 2026(01.10.2026 um 13:28 Uhr)
•••
IT Security NachrichtenAxios Flaws Let Attackers Bypass Proxy Controls and Trigger SSRF Attacks(01.10.2026 um 13:46 Uhr)
•
Sicherheitslücken (CVE)CISA nimmt Auth-Bypass in Cisco SD-WAN Manager in die KEV-Liste(01.10.2026 um 13:35 Uhr)
••••
IT Security Nachrichten[NEU] [hoch] MediaWiki Extensions: Mehrere Schwachstellen(01.10.2026 um 13:26 Uhr)
•
Malware / Trojaner / VirenThis month in security with Tony Anscombe – September 2026 edition(30.09.2026 um 10:00 Uhr)
•
Linux Tipps & HardeningHere's the top 50 most played games on Steam Deck for September 2026(01.10.2026 um 13:28 Uhr)
•••
IT Security NachrichtenAxios Flaws Let Attackers Bypass Proxy Controls and Trigger SSRF Attacks(01.10.2026 um 13:46 Uhr)
•
Sicherheitslücken (CVE)CISA nimmt Auth-Bypass in Cisco SD-WAN Manager in die KEV-Liste(01.10.2026 um 13:35 Uhr)
••••
IT Security Nachrichten[NEU] [hoch] MediaWiki Extensions: Mehrere Schwachstellen(01.10.2026 um 13:26 Uhr)
•
Intelligence View
⚡ tsecurity.de Intelligence

🚀 #09: Demystifying Reference Types

Curriculum: Hon-Gong-Ja (Java for Self-Study) Chapters: Chapter 05 (Sec 01, 02, 03) Duration: 2026-03-19 ~ 2026-03-27 (1st Reading) 1. Reference Types &…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!

Curriculum: Hon-Gong-Ja (Java for Self-Study)


Chapters: Chapter 05 (Sec 01, 02, 03)


Duration: 2026-03-19 ~ 2026-03-27 (1st Reading)









1. Reference Types & NullPointerException



A reference variable (Array, Class) being null means it does not hold any memory address.




  • The Risk: Accessing or storing data (e.g., arr[0]) while it's null triggers a NullPointerException.

  • The Fix: You must create the object in memory using the new operator first.

  • Analogy: It’s like pressing buttons on a remote control (variable) when you don’t even have a TV (object).






2. Array Initialization: Size vs. Index



When declaring new int[3], the number inside [] represents the length, not the index.




  • new int[3]: "Build a house with 3 rooms!" (Determines size)

  • arr[0]: "Go into room #0." (Accesses index)

  • Note: If the length is 3, valid indices are only 0, 1, and 2.






3. The Magic of Method Returns



I used to wonder: "If code runs top-to-bottom, why does it jump to a method at the bottom and come back up?"




  • The Bookmark Principle: When main calls add(), the computer places a "bookmark" (Return Address) at the current line and jumps to the method.

  • The Return: Once it hits return, it carries the result back to that bookmark and resumes execution.






4. Why String[] args in the Main Method?



Why is the default input always a String array?




  • Flexibility: It is easier to convert a String to a Number than vice versa. It's the safest way to receive any data type.

  • Dynamic Storage: Since the JVM doesn't know if the user will input 0 or 100 values, an array acts as a flexible container.






5. Multi-dimensional Arrays: The Candy Bag Analogy



In Java, a multi-dimensional array is an "Array of Arrays."




  • scores.length: Number of "Big Bags" (Rows) → e.g., 2

  • scores[0].length: Number of "Candies" inside the first bag (Columns) → e.g., 3

  • To get the total count, you must multiply Rows × Columns manually.






6. Why Arrays Can't "Grow" (The Real Estate Problem)



Unlike Excel, Java arrays have a fixed size because they occupy contiguous memory spaces.




  • If the neighboring "slot" in memory is already occupied by other data, the array cannot expand.

  • The Solution: To increase size, you must "move house." Create a larger new array and use System.arraycopy() to migrate the data.






7. Enumeration (Enum) Types: Address Copying



When you write Week today = Week.SUNDAY;:




  1. Heap: The actual SUNDAY object is created at a specific address (e.g., Address 100).

  2. Method Area: The name Week.SUNDAY holds the address "100".

  3. Stack: Your variable today copies that address "100".

  4. Both point to the same object, which is why == comparison returns true.






8. The Calendar API Quirks




  • No new keyword: Calendar is an abstract class. We use getInstance() to ask Java for an object suited to our current environment (e.g., Korea/Canada).

  • The MONTH + 1 Rule: Java designers treated months as array indices (0 = Jan, 1 = Feb...). You must always add 1 to get the human-readable month.









💻 Practical Pro-Tips




  • Safe Input: Use Integer.parseInt(scanner.nextLine()) to avoid common input buffer issues.

  • Variable Scope: Declare variables outside the while loop if you need to persist data across iterations.

  • Packages: If your Enum is in a different folder, don't forget the import statement! Different folders are treated as "different neighborhoods" in Java.






This post documents my journey as a non-major career changer diving into the world of Java backend development. Feedback is always welcome!

2. Cyber Threat Intelligence & Forensik

CTI Threat Relationship Graph2 Knoten / 1 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten 🚀 #09: Demystifying Reference Types

Thematisch verwandte Begriffe: Demystifying, Reference, Types · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag