Which method is used to add an element to an ArrayList?

  • add()
  • append()
  • insert()
  • push()
The add() method is used to add an element to an ArrayList in Java. It appends the specified element to the end of the list. Other methods like insert(), append(), and push() are not used for adding elements to ArrayLists.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *