java.util.Random.nextBoolean() 方法


java.util.Random.nextBoolean() 方法

package com.codingdict;

import java.util.*;

public class RandomDemo {
   public static void main( String args[] ) {

      // create random object
      Random randomno = new Random();

      // get next next boolean value
      boolean value = randomno.nextBoolean();

      // check the value  
      System.out.println("Value is: " + value);
   }     
}