⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.java

📁 PracticalJAVACode 的源码
💻 JAVA
字号:
class Test
{
  public static void main(String args[])
  {
    System.gc();
    long start = System.currentTimeMillis();
    for (int i=0; i<100000; i++)
    {
      Light lgt = new Light(1);
    }
    long end = System.currentTimeMillis();
    long val = end-start;
    System.out.println("Light is " + (end-start));

    System.gc();
    start = System.currentTimeMillis();
    for (int i=0; i<1; i++)
    {
      Heavy hvy = new Heavy(4, true);
    }
    end = System.currentTimeMillis();
    System.out.println("heavy is " + (end-start));
    val = (end-start)/val;
    System.out.println("heavy is " + val + " times more expensive");
    System.exit(0);
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -