diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2026-07-15 11:39:31 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2026-07-15 11:39:31 +0200 |
| commit | 2d500b96b934f378d842e0c398e41e02e700a4af (patch) | |
| tree | 186c3fe694e301cb8ec07b67baa7ad2129c55702 /Info | |
| parent | 68b1b7c24db67b3b492dab984d7ae2786037062d (diff) | |
| download | unterricht-2d500b96b934f378d842e0c398e41e02e700a4af.tar.gz unterricht-2d500b96b934f378d842e0c398e41e02e700a4af.zip | |
rennbahn: remove public from class and method definitions
Diffstat (limited to 'Info')
| -rw-r--r-- | Info/9/3/Rennbahn/slides.md | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Info/9/3/Rennbahn/slides.md b/Info/9/3/Rennbahn/slides.md index fc4b91e8..37675922 100644 --- a/Info/9/3/Rennbahn/slides.md +++ b/Info/9/3/Rennbahn/slides.md @@ -45,13 +45,13 @@ Startet eine Wiederholug und ruft in jedem Schritt die `act`-Methode jedes Actor :::: {.column width=60%} ```java -public class Auto { // Klassendefinition +class Auto { // Klassendefinition // Attribute int geschwindigkeit; String farbe; // Methoden - public void bewegen() { + void bewegen() { ... } } @@ -120,10 +120,10 @@ Objekte einer Klasse werden mit dem Schlüsselwort `new`{.java} erzeugt. :::: {.column width=65%} ```java -public class Auto { +class Auto { int geschwindigkeit; // Attribute int farbe; -public Auto() { // Konstruktor +Auto() { // Konstruktor geschwindigkeit = 2; farbe = "blau"; } @@ -172,8 +172,8 @@ $\Rightarrow$ Der Konstruktor ist eine [Methode]{.underline}, der wir \boldred{P \pause ```java -public class Auto { - public Auto(PARAMETER) { +class Auto { + Auto(PARAMETER) { geschwindigkeit = ...; farbe = ...; } @@ -213,7 +213,7 @@ public class Auto { ```java pubic class Rakete { int geschwindigkeit = 20; - public void bewegen() { + void bewegen() { setLocation(getX(), getY() - geschwindigkeit); } @@ -225,7 +225,7 @@ pubic class Rakete { ```java pubic class Bus { int geschwindigkeit = 3; - public void bewegen() { + void bewegen() { setLocation(getX(), getY() + geschwindigkeit); } |
