Підкажіть, що не так?
package com.javarush.task.task16.task1605;
import javax.xml.crypto.Data;
import java.util.Date;
/*
Поговорим о музыке
*/
public class Solution {
public static int delay = 1000;
public static void main(String[] args) {
Thread violin = new Thread(new Violin("Player"));
violin.start();
}
public static void sleepNSeconds(int n) {
try {
Thread.sleep(n * delay);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public interface MusicalInstrument extends Runnable {
Date startPlaying();
Date stopPlaying();
}
public static class Violin implements MusicalInstrument {
@Override
public void run() {
Date start = startPlaying();
sleepNSeconds(1);
Date finish = stopPlaying();
int res = (int) (finish.getTime() - start.getTime());
System.out.println(this.owner + " " + res + " ms.");
}
private String owner;
public Violin(String owner) {
this.owner = owner;
}
public Date startPlaying() {
System.out.println(this.owner + " is starting to play");
return new Date();
}
public Date stopPlaying() {
System.out.println(this.owner + " is stopping playing");
return new Date();
}
}
}