Computer science homework help(Java)?

Computer science homework help(Java)?




Can someone help me with these questions for my computer science homework. I really don't understand them



The length of the array is



a. 0



b. the number of elements in the array



c. the index of the last element in the array



d. the size minus 1

Question 2



Which of the following declares an array that can store references to Card objects.



a. int [] cards;



b. Card[] cards;



c. double[] cards;



d. String[] cards;





Question 3



Which of the following will create an array capable of storing the addresses of 5 Card objects and store the address of the array in the variables myCards?



a. myCards = new Card[5];



b. myCards = new int[5];



c. myCards = new Card[4];



d. myCards = new int[4];



Question 4



Which of the following will call the toString method on an element in the array referenced by myCards?



a. myCards.toString()



b. myCards[0].toString



c. myCards[0].toString()



d. myCards.toString



Question 5



Given the following code, what will be stored in total when the code has completed execution?



int[] values = {2, 4, 6};



int total = 0;



for (int i=0; i<values.length; i++)



total = values[i];



a. 2



b. 10



c. 12



d. 6





Question 6



Which of the following will compare the value of the first Card in the array to the value 10?



a. if (cards[0].getValue() > 10)



b. if (cards[0] > 10)



c. if (cards > 10)



d. if (cards.getValue() > 10)





No Answers Posted Yet.