Current location - Training Enrollment Network - Mathematics courses - Java mathematics set
Java mathematics set
I'm not sure what you mean, do you think so?

( 1):

//Take any two numbers from 1 to 100 and save them in another set.

Random r = new Random();

List & lt Integer & gt Newlist = NewArrayList ();

for(int I = 1; I<3; i++) {

int n = r . nextint( 100)+ 1;

new list . add(n);

}

//result

System.out.print ("What's out");

for(int I = 0; I<2; i++) {

system . out . print(new list . get(I)+" ");

}

(2):

//Create an array and store integers from 1 to 100.

int temp[]= new int[ 100];

for(int I = 1; I<= 100; i++) {

temp[I- 1]= I;

}

//Take any 2 numbers from the array and save them in another set.

Random r = new Random();

List & lt Integer & gt Newlist = NewArrayList ();

for(int I = 1; I<3; i++) {

int n = r . nextint( 100)+ 1;

Integer m = temp [n];

new list . add(m);

}

//result

System.out.print ("What's out");

for(int I = 0; I<2; i++) {

system . out . print(new list . get(I)+" ");

}