javascript
Brief description  about Online courses   join in Online courses
View Priti m naik 's Profile

error ..help

Dear Sir

i am getting errors for evry threads program that i try to execute

mainly constructor errors
its working in other computers but not mine..

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*<applet code="Moon" height="500" width="500"></applet>*/
public class Moon extends Applet implements Runnable{

Thread t;
int x=260,y=150;
public void init(){
t = new Thread(this,"Moon");
t.start();
setBackground(Color.black);
setForeground(Color.white);
}
public void run(){

while(true) {

if(x==140)x=260;

x-=20;

try
{
Thread.sleep(1000);
}
catch(InterruptedException e){}

repaint();
}

}
public void paint(Graphics g) {
g.fillOval(140,150,100,100);
g.setColor(Color.black);
g.fillOval(x,y,100,100);

}
}








error
moon.java:10:cannot find symbol
symbol:constructor thread(moon,java.lang.String)
location: class java.lang.thread
t=new thread(this,"moon");
^

moon.java:5: class moon extends applet implements runnable{
^


i cant move to my next assignments since days ..please solve it
Asked by Priti m naik | Oct 19, 2010 |  Reply now
Replies (2)
View nagaraj hegde 's Profile
program is 100% correct. working fine in my computer. re-install jdk. everything will be allright. happy programming :)
Nov 16, 2010
View arun kumar das 's Profile
make sure save the file Moon.java, and JDK path set properly, otherwise uninstall jdk and install again and set path in environment variable than compile it, i think it should be working properly. Because in my machine it working fine.

If still it not working than you can send it, its ok.

java teacher
Oct 20, 2010