Mittwoch lesson
This commit is contained in:
parent
e0efeb82ef
commit
8901dea11b
61 changed files with 663 additions and 0 deletions
7
Code/Steiner/tryCatchTask/.vscode/settings.json
vendored
Normal file
7
Code/Steiner/tryCatchTask/.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"java.project.sourcePaths": ["src"],
|
||||
"java.project.outputPath": "bin",
|
||||
"java.project.referencedLibraries": [
|
||||
"lib/**/*.jar"
|
||||
]
|
||||
}
|
18
Code/Steiner/tryCatchTask/README.md
Normal file
18
Code/Steiner/tryCatchTask/README.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
## Getting Started
|
||||
|
||||
Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code.
|
||||
|
||||
## Folder Structure
|
||||
|
||||
The workspace contains two folders by default, where:
|
||||
|
||||
- `src`: the folder to maintain sources
|
||||
- `lib`: the folder to maintain dependencies
|
||||
|
||||
Meanwhile, the compiled output files will be generated in the `bin` folder by default.
|
||||
|
||||
> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there.
|
||||
|
||||
## Dependency Management
|
||||
|
||||
The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies).
|
BIN
Code/Steiner/tryCatchTask/bin/App.class
Normal file
BIN
Code/Steiner/tryCatchTask/bin/App.class
Normal file
Binary file not shown.
28
Code/Steiner/tryCatchTask/src/App.java
Normal file
28
Code/Steiner/tryCatchTask/src/App.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
import java.io.*;
|
||||
|
||||
public class App {
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
readFile("test.txt");
|
||||
} catch (FileNotFoundException e) {
|
||||
System.err.println("Error: The file was not found. Please check the file path.");
|
||||
} catch (IOException e) {
|
||||
System.err.println("Error: An I/O error occurred while reading the file.");
|
||||
} catch (Exception e) {
|
||||
System.err.println("An unexpected error occurred: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static void readFile(String fileName) throws IOException {
|
||||
FileReader f = new FileReader(fileName);
|
||||
try {
|
||||
int c;
|
||||
while ((c = f.read()) != -1) {
|
||||
System.out.print((char) c);
|
||||
}
|
||||
} finally {
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
}
|
22
Code/Steiner/tryCatchTask/test.txt
Normal file
22
Code/Steiner/tryCatchTask/test.txt
Normal file
|
@ -0,0 +1,22 @@
|
|||
🎉 Super! 🎉
|
||||
|
||||
Du hast es geschafft.
|
||||
|
||||
Herzliche Gratulation!
|
||||
|
||||
🌟 STEINER 🌟
|
||||
|
||||
Ein Hauch von Magie in der Luft!
|
||||
|
||||
✨ Die Sterne funkeln, während die Gedanken fliegen. ✨
|
||||
|
||||
🔮 Zufällige Gedanken:
|
||||
|
||||
Kaffeetassen tanzen im Regen.
|
||||
Ein fliegender Teppich voller Bücher.
|
||||
Die Farben des Windes singen Lieder.
|
||||
|
||||
🌈 Lass die Kreativität sprudeln!
|
||||
|
||||
Was wäre, wenn die Fische die Wolken fangen könnten?
|
||||
Ein Abenteuer im Land der Träume wartet auf dich!
|
Loading…
Add table
Add a link
Reference in a new issue