Auf Thema antworten

Hallo Claus,


danke für die Antwort! Also wenn ich richtig verstanden habe, wäre mein Beispiel richtig entweder so:


[code]

import java.io.*;

   public class Exueb5 {

      public static void main(String[] args) {

         try {

            FileReader f=new FileReader("Exueb5.java");

            while (true) {

               int c=f.read();

               if (c<0)

               return;

               System.out.print((char)c);

             }

         }

        catch(IOException e) {}

        catch(FileNotFoundException e) {}

        }

   }

[/code]


oder so:


[code]

import java.io.*;

   public class Exueb5 {

      public static void main(String[] args) throws FileNotFoundException {

        FileReader f=new FileReader("Exueb5.java");

         try {

            while (true) {

               int c=f.read();

               if (c<0)

               return;

               System.out.print((char)c);

             }

         }

        catch(IOException e) {}

        }

   }

  [/code]


Ist es richtig?


Capri



Oben