码迷,mamicode.com
首页 > 其他好文 > 详细

简单的四则运算

时间:2015-03-28 11:31:11      阅读:89      评论:0      收藏:0      [点我收藏+]

标签:

import java.util.Random;
public class SiZe {

/**
* @param args
*/
public static void main(String[] args) {

String[] str_1 = new String[] {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
String[] str_2 = new String[] { "+", "-", "*", "/", "+", "-", "*", "/", "+", "-", "*", "/" };
int index = 0;
for(int i = 0; i < 4; i++)
{
int j = 0;
int index_1 = new Random().nextInt(9);
System.out.print(str_1[index_1]);
if(i != 3)
{
int index_2 = new Random().nextInt(12);
System.out.print(str_2[index_2]);
}
}

}

}

简单的四则运算

标签:

原文地址:http://www.cnblogs.com/OuZeBo/p/4373873.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!