1
0

Add chapters 18-20 for the java book

This commit is contained in:
2025-12-04 12:14:38 +01:00
parent 2da137aea8
commit 5eded28b16
43 changed files with 1925 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Schlafen extends Thread {
@Override
public void run() {
var inputStream = new InputStreamReader(System.in);
var bufferedReader = new BufferedReader(inputStream);
int seconds;
System.out.println("Wieviele Sekunden soll ich warten?");
try {
var input = bufferedReader.readLine();
seconds = Integer.parseInt(input);
} catch (IOException exception) {
seconds = 0;
}
try {
Thread.sleep(seconds * 1000);
} catch (InterruptedException exception) {
}
}
}