Ich habe eine Thread -Variable in Java erstellt und habe diesen Fehler erhalten: Gamethread kann nicht auf eine VariableJava

Java-Forum
Anonymous
 Ich habe eine Thread -Variable in Java erstellt und habe diesen Fehler erhalten: Gamethread kann nicht auf eine Variable

Post by Anonymous »

Hi I got an error that is about the gameThread variable in my java code
is says:
"Exception in thread "Thread-0" java.lang.Error: Unresolved compilation problem: gameThread cannot be resolved to a variable"
any ideas
thanks for the help

Code: Select all

import java.awt.Color;
import java.awt.Dimension;
import javax.swing.JPanel;

public class GamePanel extends JPanel implements Runnable{

public void startGameThread(){
Thread gameThread = new Thread(this);
gameThread.start();
}
@Override
public void run(){
while(gameThread != null){

}
}

}
Ich erwarte, dass es funktioniert

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post