package mwh;
import java.util.Random;
public class Problem {
public static void main(String[] args) {
Problem manner=new Problem();
for(int i=1;i<=30;i++){
manner.problem();
}
}
void problem(){
Random r1=new Random();
int num1= r1.nextInt(9)+1;
Random r2=new Random();
int num2=r2.nextInt(9)+1;
String[] operators = {"+", "-", "*", "/"};
int randomIndex = (int)(Math.random() * operators.length);
String randomOperator = operators[randomIndex];
System.out.println(num1+randomOperator+num2+"=");
}
}
标签:String,故事,int,operators,Random,new,Problem,疑问
From: https://www.cnblogs.com/abc233/p/18427486