id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

crehwinkel@frhsd.com apcsa-arraylists > apcsaListAddEnd
prev  |  next  |  chance

Given an ArrayList of Integers called lst, add a new element num at the end of the ArrayList. Return the ArrayList as output.

HINT
The add method with one parameter will add to the end of the ArrayList. Easy-peasy! Example:
ArrayList<Integer> myList = new ArrayList<Integer>();
myList.add(5); // myList contents: [5]
myList.add(2); // myList contents: [5, 2]

apcsaListAddEnd([3, 4, 5], 2) → [3, 4, 5, 2]
apcsaListAddEnd([5, 0, 3], 0) → [5, 0, 3, 0]
apcsaListAddEnd([3, 5, 6], 1) → [3, 5, 6, 1]

...Save, Compile, Run (ctrl-enter)

public ArrayList<Integer> apcsaListAddEnd(ArrayList<Integer> lst, int num) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 220

Copyright Nick Parlante 2017 - privacy