Ask Question
30 May, 17:19

Assume that an ArrayList of Integers named salarySteps that contains exactly five elements has been declared and initialized. Write a statement that assigns the value 160000 to the last element of the ArrayList salarySteps.

+4
Answers (1)
  1. 30 May, 19:37
    0
    Following are the statement to this question:

    //using set and size in-built method

    salarySteps. set (salarySteps. size () - 1, 160000); / /assign value at the last element of the list

    Explanation:

    Description of the above can be described as follows:

    In the question, it is declared, that an array list "salarySteps", is defined, which contains five integer elements, in this array-list at the last we insert an integer value, which is "160000". In the above code, the array list "salarySteps" uses a set method, inside this method a size method is used, that inserts the value "160000" at the last element of the array list.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Assume that an ArrayList of Integers named salarySteps that contains exactly five elements has been declared and initialized. Write a ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers