当前位置: 技术问答>java相关
救我呀!!!!!!又是100个错误......晕了.......
来源: 互联网 发布时间:2014-12-31
本文导语: 程序编译.....一阵闪电以后......显示100个错误 前几天我编了三个程序都碰到这种情况,仔细检查以后仍是这样,我想怎么也不会有这么多错误吧! 急急急急急急............烦请执教!!!!!!!!!!!!!!!!!!!!!!!! (一旦解决,马上给分) ...
程序编译.....一阵闪电以后......显示100个错误
前几天我编了三个程序都碰到这种情况,仔细检查以后仍是这样,我想怎么也不会有这么多错误吧!
急急急急急急............烦请执教!!!!!!!!!!!!!!!!!!!!!!!!
(一旦解决,马上给分)
public class Animator1 extends java.applet.Applet implements Runnable {
int frame;
int delay;
Thread animator;
public void init()
{
String str = getParameter("fps");
int fps = (str != null) ? Integer.parseInt(str) : 10;
delay = (fps > 0) ? (1000 / fps) : 100;
}
public vois start()
{
animator = new Thread(this);
animator.start();
}
public void run() {
long tm = System.currentTimeMillis();
while (Thread.currentThread() == animator) {
repaint();
try {
tm += delay;
Thread.sleep(Math.max(0,tm - System.currentTimeMillis()));
} catch (InterruptedException e) {
break;
}
frame++;
}
}
前几天我编了三个程序都碰到这种情况,仔细检查以后仍是这样,我想怎么也不会有这么多错误吧!
急急急急急急............烦请执教!!!!!!!!!!!!!!!!!!!!!!!!
(一旦解决,马上给分)
public class Animator1 extends java.applet.Applet implements Runnable {
int frame;
int delay;
Thread animator;
public void init()
{
String str = getParameter("fps");
int fps = (str != null) ? Integer.parseInt(str) : 10;
delay = (fps > 0) ? (1000 / fps) : 100;
}
public vois start()
{
animator = new Thread(this);
animator.start();
}
public void run() {
long tm = System.currentTimeMillis();
while (Thread.currentThread() == animator) {
repaint();
try {
tm += delay;
Thread.sleep(Math.max(0,tm - System.currentTimeMillis()));
} catch (InterruptedException e) {
break;
}
frame++;
}
}
|
是编译时出错吗?
除了vois->void,少了一个结尾括号,没什么错,看来是jdk本身的问题。
除了vois->void,少了一个结尾括号,没什么错,看来是jdk本身的问题。
|
老兄,你就不能用ide,这样至少可以看到是什么错误啊
我编译了除了vois和少了个}没问题.
看来是jdk的问题
我编译了除了vois和少了个}没问题.
看来是jdk的问题
|
ide就是集成开发环境(你用的是jbuilder),它往往内嵌了某个版本的jdk环境,可能对你的java运行环境产生影响。
|
程序中run()少了一个括号,vois->void,其它试正确的。
public class Animator1 extends java.applet.Applet implements Runnable {
int frame;
int delay;
Thread animator;
public void init() {
String str = getParameter("fps");
int fps = (str != null) ? Integer.parseInt(str) : 10;
delay = (fps > 0) ? (1000 / fps) : 100;
}
public void start() {
animator = new Thread(this);
animator.start();
}
public void run() {
long tm = System.currentTimeMillis();
while (Thread.currentThread() == animator) {
repaint();
try {
tm += delay;
Thread.sleep(Math.max(0,tm - System.currentTimeMillis()));
}
catch (InterruptedException e) {
break;
}
frame++;
}
}
}
public class Animator1 extends java.applet.Applet implements Runnable {
int frame;
int delay;
Thread animator;
public void init() {
String str = getParameter("fps");
int fps = (str != null) ? Integer.parseInt(str) : 10;
delay = (fps > 0) ? (1000 / fps) : 100;
}
public void start() {
animator = new Thread(this);
animator.start();
}
public void run() {
long tm = System.currentTimeMillis();
while (Thread.currentThread() == animator) {
repaint();
try {
tm += delay;
Thread.sleep(Math.max(0,tm - System.currentTimeMillis()));
}
catch (InterruptedException e) {
break;
}
frame++;
}
}
}