Write statements to do the following tasksL Question1: Print out the values stor
ID: 3615221 • Letter: W
Question
Write statements to do the following tasksLQuestion1:
Print out the values stored in the array referenced by the variableidList, one value per line.
Question2:
Print out the length of the array referenced by the variableidList.
I know the Question1's answer:
for (int index = 0; index < idList.length; index++)
System.out.println(idList[index]);
but I think the Question2's answer is the same... but I think myexpectation is incorrect. What's the difference between these twoquestions? If you don't mind, could you please do theQuestion2?
I really appreciate your help! Thank you!!!
Explanation / Answer
You are correct on question 1, good job! For question 2, it's pretty simple. All it's asking is for you toprint out the size of your array. So, if you have an array with 10slots, the length is 10. You would have the following: System.out.println(idList.length()); which returns an int value that we can print.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.