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"); } }