Ask Question
1 June, 07:43

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. 1 June, 08:45
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers