backup
This commit is contained in:
33
8/Aufgabe1.~ava
Normal file
33
8/Aufgabe1.~ava
Normal file
@@ -0,0 +1,33 @@
|
||||
import java.io.*;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Aufgabe1 {
|
||||
public static void main(String arrgs[]) { //throws IOException
|
||||
try {
|
||||
FileOutputStream schreib = new FileOutputStream("speicher.txt");
|
||||
|
||||
FileInputStream lies = new FileInputStream("speicher.txt");
|
||||
|
||||
String zeile;
|
||||
int z = 0;
|
||||
|
||||
Scanner input = new Scanner(System.in);
|
||||
|
||||
zeile = input.next();
|
||||
|
||||
schreib.write(zeile.getBytes(),0,zeile.length()); // Schreibt String zeile in Datei
|
||||
schreib.close();
|
||||
while((z=lies.read())!=-1){ // liest jede Buchstabe als Zahl und umwandelt in char
|
||||
System.out.print((char)z);
|
||||
//lies.close();
|
||||
}
|
||||
lies.close();
|
||||
|
||||
} catch(FileNotFoundException e) {
|
||||
System.out.println("Datei wurde nicht gefunden");
|
||||
} catch (IOException e) {
|
||||
System.out.println("Fehler: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user