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