2.2.1. ObjUse-WE2-P1ΒΆ
Subgoals for using objects (creating instances)
Declare variable of appropriate class datatype.
Assign to variable: keyword new, followed by class name, followed by ().
Determine whether parameter(s) are appropriate (API)
Number of parameters
Data types of the parameters
ObjUse-WE2-P1
Q5: CClick on the variables (object references) in the following code
/* creates new random object with default seed */ Random rand = new Random(); /* creates new random object with seed parameter */ Random rand2 = new Random(1234567890);
Q6: Click on the class names (but not constructors) in the following code
/* creates new random object with default seed */ Random rand = new Random(); /* creates new random object with seed parameter */ Random rand2 = new Random(1234567890);
Q7: Click on the calls to the Random constructor in the following code
/* creates new random object with default seed */ Random rand = new Random(); /* creates new random object with seed parameter */ Random rand2 = new Random(1234567890);
Q8: Click on the parameters which are passed to the Random constructor in the following code
/* creates new random object with default seed */ Random rand = new Random(); /* creates new random object with seed parameter */ Random rand2 = new Random(1234567890);
You have attempted of activities on this page