I keep getting this kind of error:
error: no suitable method found for schedule(soccer,int)
method Timer.schedule(TimerTask,long) is not applicable
(argument mismatch; soccer cannot be converted to TimerTask)
method Timer.schedule(TimerTask,Date) is not applicable
(argument mismatch; soccer cannot be converted to TimerTask)
import java.util.*;
public class Balls{
private static int time = 1;
public static void main(String[] args){
int a=0,b=0,c=0,d=0,e=0;
volley one = new volley();
beach two = new beach();
soccer three = new soccer();
basket four = new basket();
pokemon five = new pokemon();
Timer myTime1 = new Timer();
Timer myTime2 = new Timer();
Timer myTime3 = new Timer();
Timer myTime4 = new Timer();
Timer myTime5 = new Timer();
for(int x=0; x<20000; x+=5000){
if(x==5000){
myTime1.schedule(one,(x-1000));
myTime1.schedule(two,(x+500));
myTime1.schedule(three,(x-500));
myTime1.schedule(four,(x+1000));
myTime1.schedule(five,(x-500));
}
else if(x==10000){
myTime1.schedule(one,(x+500));
myTime1.schedule(two,(x-1000));
myTime1.schedule(three,(x+1000));
myTime1.schedule(four,(x-500));
myTime1.schedule(five,(x+500));
}
else if(x==15000){
myTime1.schedule(one,(x-500));
myTime1.schedule(two,(x+1000));
myTime1.schedule(three,(x+500));
myTime1.schedule(four,(x+500));
myTime1.schedule(five,(x+1000));
}
else if(x==20000){
myTime1.schedule(one,(x+1000));
myTime1.schedule(two,(x-500));
myTime1.schedule(three,(x-1000));
myTime1.schedule(four,(x-1000));
myTime1.schedule(five,(x-1000));
}
else{
break;
}
}
}
}
class volley extends TimerTask{
public void run(){
System.out.println("Volley ball");
}
}
class beach extends TimerTask{
public void run(){
System.out.println("Beach ball");
}
}
class soccer{
public void run(){
System.out.println("Soccer ball");
}
}
class basket{
public void run(){
System.out.println("Basket ball");
}
}
class pokemon{
public void run(){
System.out.println("Pokemon Ball");
}
}
Sorry for poor post, first time doing it.