Reputation:
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?
Upvotes: 1
Views: 117
Reputation: 31858
To avoid using same class name conflicts, you should use the complete package name or the fully qualified name as:
java.util.Timer timer = new java.util.Timer();
timer.schedule(new Run(), 0, 5000);
Upvotes: 1