1.
- Random rand = rand();
- Random rand = rand(50);
- Random rand = new Random();
- Random rand = new Random(50);
Q1: Which of the following will correctly declare and instantiate a new variable to generate Random values?
static
method or instance
methodstatic
, use the class nameinstance
, must have or create an instance// assume you have declared and initialized variable rand to
// be an instance of the Random class
_______ result = rand._______ ( __________ ) + ___________ ;
D A B C
// assume you have declared and initialized variable rand to
// be an instance of the Random class
_______ result = rand._______ ( __________ ) + ___________ ;
D A B C
// assume you have declared and initialized variable rand to
// be an instance of the Random class
_______ result = rand._______ ( __________ ) + ___________ ;
D A B C