[BlueJ] Fehlermessage: Cannot find symbol

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    • [BlueJ] Fehlermessage: Cannot find symbol

      Hallo! Vom Prof angeraten, hab ich mal Eclipse beiseite gelegt und BlueJ ausprobiert. Nur scheint bei den Einstellungen iwas nicht zu stimmen, denn ein Code wie dieser hier:

      Quellcode

      1. class ThreadHelloCount
      2. {
      3. public static void main(String args[])
      4. {
      5. HelloThread hello = new HelloThread();
      6. CountThread count = new CountThread();
      7. hello.start();
      8. count.start();
      9. }
      10. }
      11. class HelloThread extends Thread
      12. {
      13. public void run()
      14. {
      15. int pause;
      16. for (int i=0; i<5; i++)
      17. {
      18. try
      19. {
      20. System.out.println("Hello!");
      21. pause = (int)(Math.random() * 3000);
      22. sleep(pause);
      23. }
      24. catch (InterruptedException e)
      25. {
      26. System.out.println(e.toString());
      27. }
      28. }
      29. }
      30. }
      31. class CountThread extends Thread
      32. {
      33. int pause;
      34. public void run()
      35. {
      36. for (int i=0; i<5; i++)
      37. {
      38. try
      39. {
      40. System.out.println(i+1);
      41. pause = (int)(Math.random() * 3000);
      42. sleep(pause);
      43. }
      44. catch (InterruptedException e)
      45. {
      46. System.out.println(e.toString());
      47. }
      48. }
      49. }
      50. }
      Alles anzeigen


      lässt sich nicht ausführen. Denn wenn ich die main-Methode aufrufe und dann ausführen will (also auch ohne übergebene Argumente), kommt das hier:
      "Error: Cannot find symbol - variable ThreadHelloCount"

      Das Ganze funktioniert übrigens in Eclipse einwandfrei.

      ?( ?(
      FEHLER VERMEIDET MAN, INDEM MAN ERFAHRUNG SAMMELT. ERFAHRUNG SAMMELT MAN, INDEM MAN FEHLER MACHT.