java 的非法表达式开始是怎么回事?
importjava.awt.*;importjava.applet.*;publicclassMovewordsextendsAppletimplementsRunna...
import java.awt.*;
import java.applet.*;
public class Movewords extends Applet implements Runnable
{
Thread aThread = null;
String word = "Welcome!";
Font f = new Font("TimesRoman",Font.BOLD,18);
int x,y;
public void init()
{
x = size().width;
y = size().height/2;
}
public void start()
{
if(aThread= =null){
aThread = new Thread(this);
aThread.start();
}
}
public void run()
{
while(true)
{x=x-5;
if(x= =0) x=size().width;
repaint();
try
{
aThread.sleep(500);
}
catch(InterruptedException e)
{
}
}
}
public void paint(Graphics g)
{
g.setFont(f);
g.drawString(word,x,y);
}
}
总是出现非法表达式开始
16行:if(x= =0)和if(aThread= =null) 第二个=号说:非法表达式开始
希望告诉我是怎么回事?谢谢!! 展开
import java.applet.*;
public class Movewords extends Applet implements Runnable
{
Thread aThread = null;
String word = "Welcome!";
Font f = new Font("TimesRoman",Font.BOLD,18);
int x,y;
public void init()
{
x = size().width;
y = size().height/2;
}
public void start()
{
if(aThread= =null){
aThread = new Thread(this);
aThread.start();
}
}
public void run()
{
while(true)
{x=x-5;
if(x= =0) x=size().width;
repaint();
try
{
aThread.sleep(500);
}
catch(InterruptedException e)
{
}
}
}
public void paint(Graphics g)
{
g.setFont(f);
g.drawString(word,x,y);
}
}
总是出现非法表达式开始
16行:if(x= =0)和if(aThread= =null) 第二个=号说:非法表达式开始
希望告诉我是怎么回事?谢谢!! 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询