(Java) 1/ Bowler[ ] myTeam; How many objects did the line above create? 2/ Bowle
ID: 3685158 • Letter: #
Question
(Java)
1/ Bowler[ ] myTeam;
How many objects did the line above create?
2/ Bowler[ ] myTeam = new Bowler[5];
How many objects did the line above create?
3/ What will happen if I try to run this next statement after code in question 1 and question 2 execute?
System.out.println(myTeam[2]);
4/ After line question 2 executes. What is held in each element of the myTeam array?
5/ Write the code to create the five Bowlers to fill the array of the myTeam array of references. Use the default constructor for the Bowler class.
6/ Declare an array to hold 50 double values and assign the values for each element.
Then, declare a new array with 100 elements and assign the values of the first array to this new array. Then rename this new array to the name of the original array.
Explanation / Answer
Answer:)
1. The line is creating an array of objects. However, the size of array is not specified.
2. The line is creating an array of 5 objects.
3.Object details of the 3rd object will be printed for the given statement.
4. Each element of myTeam array will hold an object with values as per the default constructor.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.