這是代碼:
Random randomNumber = new Random();
System.out.println(randomNumber.nextInt(10));
Random randomNumberTwo = new Random();
System.out.println(randomNumberTwo.nextDouble());
System.out.println(randomNumber randomNumberTwo);
終端說:java:二元運算子' '的錯誤運算元型別
uj5u.com熱心網友回復:
randomNumber 和 randomNumberTwo 是生成器,因此為了添加它們,您需要從中生成下一個值:
Random randomNumber = new Random();
Random randomNumberTwo = new Random();
System.out.println(randomNumber.nextInt(10) randomNumberTwo.nextDouble());
uj5u.com熱心網友回復:
在這里,您將類亂數的物件添加到此
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);
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/334820.html
標籤:爪哇
