System.currentTimeMillis()

This commit is contained in:
seahi 2024-11-10 21:28:50 +08:00
parent 57e12cb859
commit fe9964116e

View File

@ -0,0 +1,14 @@
package chapter5;
public class Example11 {
public static void main(String[] args) {
long startTime = System.currentTimeMillis();
String test = "";
for (int i = 0; i < 100000; i ++) {
test += "test";
}
long endTime = System.currentTimeMillis();
System.out.println("程序运行的时间:" + (endTime - startTime) + "ms");
}
}