Home Ask Login Register

Developers Planet

Your answer is one click away!

dulindraxe 2 weeks ago

Unable to execute my Timer

I can't understand what is wrong in this code:

import java.util.*;

public class Timer {

    public static void main(String[] args) {
        Timer timer = new Timer();
        timer.schedule(new Run(), 0, 5000);
    }
}

It's the first time I use Timer in Java and it says

error: cannot find symbol timer.schedule(new Run(), 0, 5000); ^ symbol: method schedule(new Run(), int, int) location: variable timer of type Timer

What am I missing?

Answers


Tyler 2 weeks ago

You are creating an instance of your class Timer. Your class Timer does not have a method schedule. If you are trying to use this timer, I suggest naming your class something else

Post Status

Asked in 2 weeks ago
Viewed 2,924 times
Voted 10
Answered 1 times

Search




Leave an answer


Quote of the day: live life