Questions tagged «system.out»

3
为什么打印“ B”比打印“#”要慢得多?
我生成了1000x的两个矩阵1000: 第一矩阵:O和#。 第二矩阵:O和B。 使用以下代码,第一个矩阵花费了8.52秒完成: Random r = new Random(); for (int i = 0; i < 1000; i++) { for (int j = 0; j < 1000; j++) { if(r.nextInt(4) == 0) { System.out.print("O"); } else { System.out.print("#"); } } System.out.println(""); } 使用此代码,第二个矩阵花费了259.152秒来完成: Random r = new Random(); for (int …

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.