Here is the code:
Random randomNumber = new Random();
System.out.println(randomNumber.nextInt(10));
Random randomNumberTwo = new Random();
System.out.println(randomNumberTwo.nextDouble());
System.out.println(randomNumber randomNumberTwo);
The terminal says: java: bad operand types for binary operator ' '
CodePudding user response:
randomNumber and randomNumberTwo are generators, so in order to add them you need to generate the next value from them:
Random randomNumber = new Random();
Random randomNumberTwo = new Random();
System.out.println(randomNumber.nextInt(10) randomNumberTwo.nextDouble());
CodePudding user response:
Here you are adding the objects of the class random numbers instead to this
Random randomNumber = new Random();
int a = randomNumber.nextInt(10)
System.out.println(randomNumber.nextInt(10));
Random randomNumberTwo = new Random();
double b = randomNumberTwo.nextDouble()
System.out.println(randomNumberTwo.nextDouble());
System.out.println(a b);