public class MathDemo01 { public static void main (String args []) { // Math class methods are static methods, directly using the "class method names ()" call with the form System.out.println ( "seek root: "+ the Math.sqrt (9.0 )); System.out.println ( " seeking the maximum of two numbers: "+ Math.max (10,30 )); System.out.println ( " find the minimum number of two value: "+ Math.min (10,30 )); System.out.println ( " power of 2. 3: "Math.pow + (2,3 )); System.out.println ( " rounded: "+ Math.round (33.6 )); } };
import java.util.Random ; public class RandomDemo01{ public static void main(String args[]){ Random r = new Random() ; // 实例化Random对象 for(int i=0;i<10;i++){ System.out.print(r.nextInt(100) + "\t") ; } } };