问大家一个简单的问题 问一个简单的程序, 实现功能是 根据用户传入的一个数字 随机产生两个 大于0 小于传入数字的 数字 ,有什么好的算法没有,我写了一个 总觉得并不是最好,来看看大家的实现。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import java.io.*; class Getchar{ public static void main(String args[])throws IOException { for(;;) { System.out.print("Iuput:"); int i=0; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String s=br.readLine(); int y = Integer.parseInt(s); if(y==1 || y==0) { System.out.println("Check ur input!>>>"); continue; } while(i!=2) { int r=(int) (Math.random()*y); if(r!=0) { System.out.println(r); i++; } } System.out.println("------------------------------"); } }} 从list中取出,想放入数组中 指点软件开发用CS架构 关于树的遍历问题 请问2个JAVA实例·!请各位帮帮·!谢谢·! 问resultSet 的问题 来个经典题目,大家写算法 java Applet得一个问题,请大侠帮忙,谢谢~ 求助 编写程序如编写人生,有人和我的意见相同吗? java 加密问题 各位大虾请教java读取*.tar.gz压缩文件问题 问个关于输出字符串组合数的问题?
class Getchar{
public static void main(String args[])throws IOException
{
for(;;)
{
System.out.print("Iuput:");
int i=0;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s=br.readLine();
int y = Integer.parseInt(s);
if(y==1 || y==0)
{
System.out.println("Check ur input!>>>");
continue;
}
while(i!=2)
{
int r=(int) (Math.random()*y);
if(r!=0)
{
System.out.println(r);
i++;
}
}
System.out.println("------------------------------");
}
}
}