总结:不习惯你在或不在的时候,赶紧走吧
package com.mmm; import java.util.Random; public class wW { public static double aaa() { double s = 0.0; while (true) { if ((s = Math.random() * 10) < Math.PI) { break; } // 刚定义double型时在外部报错,以为不在方法里面了 } return 0; } public static void main(String[] args) { Random r = new Random(); int s = 0, s2 = 0; s = (int) (Math.random() * 10); s2 = (int) (Math.random() * 10); // s=(int)(Math.random()*10); // double a=aaa(); // double b=aaa(); double max = Math.max(s, s2); System.out.println(max); System.out.println(Math.sin(max)); System.out.println(Math.cos(max)); } }