Ask Question

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.

+5
Answers (1)
  1. 12 September, 10:38
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers