forked from Labore/PR2-L
1
0
Fork 0

add IteratorDemo and Standarddatenstroeme

main
Gerd Marmitt 2025-03-31 08:34:45 +02:00
parent 4ba4cec390
commit cf66899346
12 changed files with 137 additions and 0 deletions

35
.vscode/launch.json vendored
View File

@ -4,6 +4,41 @@
// Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Eingabe_BufferedReader",
"request": "launch",
"mainClass": "Eingabe_BufferedReader",
"projectName": "PR2-L_e28f9f2c"
},
{
"type": "java",
"name": "Eingabe",
"request": "launch",
"mainClass": "Eingabe",
"projectName": "PR2-L_e28f9f2c"
},
{
"type": "java",
"name": "Roemisch",
"request": "launch",
"mainClass": "Roemisch",
"projectName": "PR2-L_e28f9f2c"
},
{
"type": "java",
"name": "DemoAnonymeKlasse",
"request": "launch",
"mainClass": "DemoAnonymeKlasse",
"projectName": "PR2-L_e28f9f2c"
},
{
"type": "java",
"name": "App",
"request": "launch",
"mainClass": "App",
"projectName": "PR2-L_e28f9f2c"
},
{
"type": "java",
"name": "UI",

View File

@ -0,0 +1,16 @@
import java.util.Iterator;
public class App {
public static void main(String[] args) throws Exception {
System.out.println("Hello, Iterator!");
Sammlung sammlung = new Sammlung();
Iterator i = sammlung.iterator();
while(i.hasNext())
{
System.out.println(i.next());
}
}
}

View File

@ -0,0 +1,26 @@
import java.util.Iterator;
import java.util.Scanner;
public class Sammlung implements Iterator, Iterable
{
String einKunde = "Gerd\tMarmitt\tMannheim";
Scanner einScanner = new Scanner(einKunde).useDelimiter("\\t");
public boolean hasNext() {
return einScanner.hasNext();
}
public Object next() {
return einScanner.next();
}
public void remove() {
throw new UnsupportedOperationException();
}
// zusaetzlich fuer Iterable
public Iterator iterator() {
return this;
}
}

View File

@ -0,0 +1,7 @@
{
"java.project.sourcePaths": ["src"],
"java.project.outputPath": "bin",
"java.project.referencedLibraries": [
"lib/**/*.jar"
]
}

View 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).

View File

@ -0,0 +1,7 @@
{
"java.project.sourcePaths": ["src"],
"java.project.outputPath": "bin",
"java.project.referencedLibraries": [
"lib/**/*.jar"
]
}

View 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).

View File

@ -0,0 +1,10 @@
public class Standarddatenstroeme {
public static void main(String[] args) throws Exception {
// Ausgabe umleiten mit 1>
System.out.println("Hello, World!");
// Aussgabe umleiten mit 2>
System.err.println("Hello, Error!");
}
}