无法解析导入 java.util.Arraylist 怎么解决啊
给一下具体解决方法吧。代码如下:importjava.math.BigInteger;importjava.util.Arraylist;publicclassUseAr...
给一下具体解决方法吧。代码如下:
import java.math.BigInteger;
import java.util.Arraylist;
public class UseArrayList
{
public static void main(string[] args)
{
ArrayList alist = factorial(35);
for(int i = 0;i < alist.size();i++)
{
System.out.println(i + "!=" + alist.get(i));
}
}
public static ArrayList factorial(int x)
{
ArrayList alist = new ArrayList();
alist.add(BigInteger.valueOf(1));
for(int i =alist.size();i < x;i++)
{
BigInteger lastfact = (BigInteger)alist.get(i-1);
BigInteger nextfact = lastfact.multiply(BigInteger.valueOf(i));
alist.add(nextfact);
}
return alist;
}
} 展开
import java.math.BigInteger;
import java.util.Arraylist;
public class UseArrayList
{
public static void main(string[] args)
{
ArrayList alist = factorial(35);
for(int i = 0;i < alist.size();i++)
{
System.out.println(i + "!=" + alist.get(i));
}
}
public static ArrayList factorial(int x)
{
ArrayList alist = new ArrayList();
alist.add(BigInteger.valueOf(1));
for(int i =alist.size();i < x;i++)
{
BigInteger lastfact = (BigInteger)alist.get(i-1);
BigInteger nextfact = lastfact.multiply(BigInteger.valueOf(i));
alist.add(nextfact);
}
return alist;
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询