Advertisement
Asphorm

Java Fehler

Jun 18th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.97 KB | None | 0 0
  1. public class Test {
  2.     public static void main(String[] args) {
  3.        
  4.         File file = new File("daten_org.txt");
  5.         try {
  6.             file.createNewFile();
  7.         } catch(IOException e) {
  8.             System.out.println("ERROR: Datei konnte nicht erstellt werden");
  9.         }
  10.        
  11.         try {
  12.             PrintStream prs = new PrintStream(file);
  13.         } catch (IOException e) {
  14.             System.out.println("ERROR: PrintStream konnte nicht erstellt werden.");
  15.         }
  16.         int j;
  17.         for(int i = 0; i < 165; i++) {
  18.             j = (int) (Math.random() * 999);
  19.             prs.print(j + " ");
  20.         }
  21.         prs.close();
  22.     }
  23. }
  24.  
  25. ---------------------------------------------------------------------------------------------------------------------------------
  26.  
  27. test.java:19: error: cannot find symbol
  28.                         prs.print(j + " ");
  29.                         ^
  30.   symbol:   variable prs
  31.   location: class Test
  32. test.java:21: error: cannot find symbol
  33.                 prs.close();
  34.                 ^
  35.   symbol:   variable prs
  36.   location: class Test
  37. 2 errors
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement