diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-12-03 11:41:57 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-12-03 11:41:57 +0100 |
| commit | 64bfaf9a6236b12a381436a4e392c03f135b0cce (patch) | |
| tree | b6102b265fcbe9682470a62d5d576adbedc2a0d2 /Info/10 | |
| parent | c28632b2e3e51c08141163db6c7b33f2fe6b6079 (diff) | |
| download | unterricht-64bfaf9a6236b12a381436a4e392c03f135b0cce.tar.gz unterricht-64bfaf9a6236b12a381436a4e392c03f135b0cce.zip | |
improve java cheatsheet
Diffstat (limited to 'Info/10')
| -rw-r--r-- | Info/10/java_cheatsheet.md | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Info/10/java_cheatsheet.md b/Info/10/java_cheatsheet.md index c0074e5f..ffa3245c 100644 --- a/Info/10/java_cheatsheet.md +++ b/Info/10/java_cheatsheet.md @@ -31,8 +31,8 @@ pagestyle: empty |Zeichenketten | `String`{.java}: z. B. "Hallo" | +-----------------------+----------------------------------------------------------------------------+ |Deklaration | ```java | -|und Zuweisung | int x; | -|bei primitiven | x = 6; | +|und Zuweisung | int x; // Deklaration einer Variable x | +|bei primitiven | x = 6; // Initialisierung von x mit dem Wert 6 | |Datentypen | ``` | +-----------------------+----------------------------------------------------------------------------+ | Klasse mit | ```java | @@ -70,7 +70,7 @@ pagestyle: empty | bzw. Arrays | | +-----------------------+----------------------------------------------------------------------------+ | Zugriff auf | ```java | -|einzelnes Element | String[] wochentage = new String[7]; | +| einzelnes Element | String[] wochentage = new String[7]; | | eines Arrays | wochentage[0] = "Sonntag"; | | | ``` | +-----------------------+----------------------------------------------------------------------------+ @@ -84,7 +84,7 @@ pagestyle: empty +-----------------------+----------------------------------------------------------------------------+ | Methode mit | ```java | | Rückgabewert | int quadrieren(int zahl) { | -| | return zahl*zahl; | +| | return zahl*zahl; | | | } | | | ``` | +-----------------------+----------------------------------------------------------------------------+ @@ -100,11 +100,11 @@ pagestyle: empty | | * `||`{.java} oder | +-----------------------+----------------------------------------------------------------------------+ | Bedingte | ```java | -| Anweisung (bei | if(farbe == "rot") { | -| einseitiger | anzahlRot = anzahlRot + 1; | -| bedingter | } else { | +| Anweisung (bei | if(farbe == "rot") { | +| einseitiger | anzahlRot = anzahlRot + 1; | +| bedingter | } else { | | Anweisung | //... | -| entfällt der | } | +| entfällt der | } | | else-Teil) | ``` | +-----------------------+----------------------------------------------------------------------------+ |Zählwiederholung | ```java | @@ -114,9 +114,9 @@ pagestyle: empty | | ``` | +-----------------------+----------------------------------------------------------------------------+ |Wiederholung mit | ```java | -|Anfangsbedingung | while(!berührt()) { | -| | gehen(10); | -| | } | +|Anfangsbedingung | while(!berührt()) { | +| | gehen(10); | +| | } | | | ``` | +-----------------------+----------------------------------------------------------------------------+ |Konsolenausgabe | `System.out.println(...)`{.java} | |
