您现在的位置:龙卷风首页 ›› 网络编程 ›› 阅读文章

chapter 4 practice 3

create a reference array with class P2

//: c4/P3.java
// create a reference array with class P2
import java.util.*;

public class P3{
 static Random rand = new Random();
 static int pRand(int mod){
  return Math.abs(rand.nextInt()) % mod + 1;
 }
 public static void main(String[] args){
  P2[] nbs = new P2[pRand(10)];
  System.out.println("nbs's length is: " + nbs.length);
  System.out.println("OK.There will no notebook object be created.");
 }
}

作者 不见不散 本文仅代表作者观点,与龙卷风资讯网立场无关。

我来说两句

内容/Content