代码是: import java.math.*; import java.util.*;public class BigInteger { public static void main(String[] args) { Scanner in = new Scanner (System.in); System.out.print("How many numbers do you want to draw?"); int k = in.nextInt(); System.out.print("what is the highest number can you draw?"); int n = in.nextInt(); BigInteger lotterOdds = BigInteger.valueOf(1); for (int i=1;i<k;i++) lotterOdds = lotterOdds.multiply(BigInteger.valueOf(n-i+1)).divide(BigInteger.valueOf(i)); System.out.println("Your odds is 1 in "+lotterOdds+". Good luck!"); }}报错是: 没有为类型 BigInteger 定义方法 valueOf(int) 没有为类型 BigInteger 定义方法 valueOf(int) at BigInteger.main(BigInteger.java:12) 我的jdk是5.0的
1.4没这个方法
import java.math.*;
import java.util.*;public class BigInteger { public static void main(String[] args) {
Scanner in = new Scanner (System.in);
System.out.print("How many numbers do you want to draw?");
int k = in.nextInt();
System.out.print("what is the highest number can you draw?");
int n = in.nextInt();
BigInteger lotterOdds = BigInteger.valueOf(1);
for (int i=1;i<k;i++)
lotterOdds = lotterOdds.multiply(BigInteger.valueOf(n-i+1)).divide(BigInteger.valueOf(i)); System.out.println("Your odds is 1 in "+lotterOdds+". Good luck!");
}}报错是:
没有为类型 BigInteger 定义方法 valueOf(int)
没有为类型 BigInteger 定义方法 valueOf(int) at BigInteger.main(BigInteger.java:12)
我的jdk是5.0的