I am trying to learn how to use threads to run a couple of methods repeatedly. This is my code and I get a compilation error when I try to run it. I am confused. help.
public void doA() {
System.out.println("now I am doing A");
}
public void doB() {
System.out.println("now I am doing B");
}
public void sleep() {
System.out.println( " Zzzzzzz...");
}
public void live() {
new Thread() {
public void run() {
while (true) {
doA();
doB();
sleep();
}
}
}.start();
}