Update Scope
This commit is contained in:
parent
cb180a0be4
commit
17c8bff5ed
Binary file not shown.
After Width: | Height: | Size: 7.1 KiB |
|
@ -5,3 +5,28 @@ url: https://git.haw-hamburg.de/pm1-tutorium/slides
|
|||
header: Programmieren 1 **Tutorium**
|
||||
footer: Henri Burau und Eva Meinen
|
||||
-->
|
||||
|
||||
# Referenzvariablen
|
||||
|
||||
## Referenz- vs. Typvariablen
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
```java
|
||||
public class Person{
|
||||
public int age;
|
||||
public Person(int age) {age = age;}
|
||||
}
|
||||
|
||||
Person Henri = new Person(0);
|
||||
Person Eva = new Person(0);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```java
|
||||
boolean bool1 = Eva == Henri;
|
||||
boolean bool2 = Eva.equals(Henri);
|
||||
```
|
3
scope.md
3
scope.md
|
@ -10,7 +10,7 @@ footer: Henri Burau und Eva Meinen
|
|||
|
||||
= Sichtbarkeit = Gültigkeitsbereich
|
||||
|
||||
Bereich in dem auf die Variable zugegriffen werden kann
|
||||
= Bereich in dem auf die Variable zugegriffen werden kann
|
||||
|
||||
---
|
||||
|
||||
|
@ -18,6 +18,7 @@ Bereich in dem auf die Variable zugegriffen werden kann
|
|||
int zahl = 3;
|
||||
addierer(zahl);
|
||||
System.out.printf(zahl); // Konsolenausgabe?
|
||||
|
||||
public void addierer(int zahl) {
|
||||
zahl++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue