Created
March 28, 2019 20:16
-
-
Save ajbinky/ec2266ec205808cbf7f5ea7bb8b16d47 to your computer and use it in GitHub Desktop.
TimedResponse using System.currentTimeMillis()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main.cis171.kelli.week09; | |
import javax.swing.*; | |
public class MyTimedResponse { | |
private static String question = "Who is your idol?"; | |
public static void main(String[] args) { | |
long start, end; | |
start = System.currentTimeMillis(); | |
JOptionPane.showInputDialog(question); | |
end = System.currentTimeMillis(); | |
long seconds = (end / 1000) - (start / 1000); | |
String difference = "It took " + seconds + " seconds for you to answer.\nWas it a difficult decision?"; | |
JOptionPane.showMessageDialog(null, difference, "Output", 1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment