有以下两个代码: package com.lk.A; public class Test3 { public static void main(String[] args) { try { int a = args.length; int b = 42/a; int c[] = {42}; c[42] = 42; System.out.println("b="+b); } catch (ArithmeticException e) { // TODO: handle exception…
写一个小程序,用来计算它包含的代码所需的耗时.虽然简单,测试代码是否耗时还是有点用的,不用重新写嘛~ import java.util.Date; import java.util.concurrent.TimeUnit; public class TimeLag { private Date start; private Date end; public TimeLag() { start = new Date(); } public String cost() { end = new Dat…