Adding Elements to Array or ArrayList? - Printable Version +- Support Forums (https://www.supportforums.net) +-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87) +--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18) +---- Forum: Java Programming (https://www.supportforums.net/forumdisplay.php?fid=22) +---- Thread: Adding Elements to Array or ArrayList? (/showthread.php?tid=25406) |
Adding Elements to Array or ArrayList? - BleepyEvans - 02-29-2012 Hi guys, I need some help. Im trying to create a comment system in an applet. When a user enters a new comment all previous comments are shown below. The comments are taken from two text fields. At the moment im just storing the latest 2 comments in variables, I need to find a way of adding them to an array. All my efforts have failed as I cant seem to find a way to add an element to the very end of an array. Ive pasted both the comment system and a stripped down version of the applet, just so you can replicate what im looking at right now. My current comment system is below. Code: if(comment1 == null) This is a stripped down version of my applet Code: import java.util.*; Any help is appreciated. Thanks RE: Adding Elements to Array or ArrayList? - Clarencetew24 - 05-19-2017 the moment im just storing the latest 2 comments in variables, I need to find a way of adding them to an array |