76 339
Assignments Done
Successfully Done
In May 2019

Answer to Question #46740 in Java | JSP | JSF for Kishore Kumar

Question #46740
java programme which will print the current time on the console every two seconds after doing this activity for 20 seconds the program quits.
Expert's answer
import java.util.Date;

public class PrintTime {

public static voidmain(String[] args) throws InterruptedException {
long start =System.currentTimeMillis();
while (true) {
System.out.println(new Date());
long finish =System.currentTimeMillis();
if (finish - start>= 20000) {

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions