JAVA简单的语法错误

来源:百度知道 编辑:UC知道 时间:2024/05/28 20:26:44
if(x++){ y+=2;
x/=2;
else{ y-=+2;
x+=1;
}
}

哪里错了?
public class TestApplet extends Applet
{ Label testLabel;
public void init(String args[])
{ testLabel=new Label("Go!");
add(testLabel);
}
}

import java.applet.*;
import java.awt.*;
public class HelloApplet {
public String s;
public void init()
{
s = new String(“Hello World!”)
}
public void paint(Graphics g)
{
g.drawString(s,25,25);
}
}
上面是3道题目
帮忙改正一下

第一个:y-=+2; 什么意思?打错了?应该是y-=2;吧?
第三个:s = new String(“Hello World!”) 这句,双引号应该用英文半角模式下的,应该是这个"Hello Word!" . 还有语句后面少了分号;
正确的应该是这样s=new String("Hello Word!");