This commit is contained in:
acp059 2020-05-27 14:02:33 +02:00
commit 09f202a020
2 changed files with 20 additions and 0 deletions

Binary file not shown.

View File

@ -38,6 +38,26 @@ import static Direction.*;
Direction malle = SOUTH;
```
---
## Methoden
Da Enums Klassen sind können sie auch Methoden deklarieren.
```java
enum Direction {
NORTH,
EAST,
SOUTH,
WEST
public String ascii() {
switch(this) {
case NORTH: return "^\n|";
case EAST: return "->";
case SOUTH: return "|\nv";
case WEST: return "<-";
}
}
}
```