<div>Did you try my example code? You will of course need to import java.util.* to use the ArrayList...</div>
<div> </div>
<div>Just copy and paste the following to array.java, then javac array.java:</div>
<div> </div>
<div> </div>
<div>
<p><font face="courier new,monospace">import java.util.*;</font></p>
<p><font face="courier new,monospace">class array {</font></p>
<p><font face="courier new,monospace">public static void main(String args[]) {</font></p>
<p><font face="courier new,monospace"> ArrayList message = new ArrayList();</font></p>
<p><font face="courier new,monospace"> message.add("Hello World");<br> message.add("Another Chat Entry");<br> message.add("Final entry");</font></p>
<p><font face="courier new,monospace"> System.out.println(message); // this obviously just invokes toString...</font></p>
<p><font face="courier new,monospace"> // The following uses an iterator which is more efficient than<br> // enumerating them manually:</font></p>
<p><font face="courier new,monospace"> Iterator itr = message.iterator();</font></p>
<p><font face="courier new,monospace"> while (itr.hasNext()) {<br> Object element = itr.next(); //obviously use Object as the root of all..<br> System.out.println(element);<br> }<br>}</font></p></div>
<div><br><br> </div>
<div><span class="gmail_quote">On 12/7/05, <b class="gmail_sendername">Stephen Elliott</b> <<a href="mailto:techweb@ntlworld.com">techweb@ntlworld.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi,<br><br>Cheers for your help guys. I could not get that to work, came up with unable<br>to resolve symbol errors amongst other things.
<br><br>Unfortunately my knowledge of Java isn't all that great.<br><br>Steve...<br><br>-----Original Message-----<br>From: <a href="mailto:0MMyrtek@oag.com">0MMyrtek@oag.com</a> [mailto:<a href="mailto:0MMyrtek@oag.com">
0MMyrtek@oag.com</a>]<br>Sent: 07 December 2005 08:58<br>To: <a href="mailto:techweb@ntlworld.com">techweb@ntlworld.com</a><br>Subject: RE: [Beds] Java Question<br><br><br>Hi ,<br><br><br>Try this:<br><br><br><br>ArrayList _arrayList = new ArrayList();
<br>_arrayList.add("blablahbla");<br><br><br>for (int j = 0; j < _arrayList.size(); j++) {<br> System.out.println(_arrayList.get(j));<br>}<br><br>Rgds Mike<br><br><br>-----Original Message-----<br>
From: <a href="mailto:beds-bounces@mailman.lug.org.uk">beds-bounces@mailman.lug.org.uk</a><br>[mailto:<a href="mailto:beds-bounces@mailman.lug.org.uk">beds-bounces@mailman.lug.org.uk</a>] On Behalf Of Stephen Elliott<br>Sent: 06 December 2005 14:13
<br>To: <a href="mailto:beds@mailman.lug.org.uk">beds@mailman.lug.org.uk</a><br>Subject: [Beds] Java Question<br><br><br>Hi there,<br><br><br>I have a quick Java question I'd like to run past any Java Gurus out<br>there. I am writing a multi-thread chat server programming using RMI and
<br>want to store all the messages users send to each other in an array. The<br>purpose being, when someone new joins the chat room they will receive<br>all previous messages users have sent to one another. So far all I can
<br>do is store a predefined amount e.g. 100. I have achieved this by<br>creating a string array with 100 elements. What I would like to do is be<br>able to store an infinite number of messages but is it possible to<br>create an array with an infinite number of elements.
<br><br>I hope what I have said makes sense, this is as you've probably guessed<br>an assignment we have been given at University. I have asked my lecturer<br>and he says this is beyond the scope of the course but to me it seems
<br>foolhardy to write a program that will crash once 100 messages have been<br>relayed.<br><br>Many Thanks<br>Steve...<br>--<br>No virus found in this outgoing message.<br>Checked by AVG Free Edition.<br>Version: 7.1.362
/ Virus Database: 267.13.12/192 - Release Date:<br>05/12/2005<br><br><br>_______________________________________________<br>Beds mailing list<br><a href="mailto:Beds@mailman.lug.org.uk">Beds@mailman.lug.org.uk</a> <a href="http://mailman.lug.org.uk/mailman/listinfo/beds">
http://mailman.lug.org.uk/mailman/listinfo/beds</a><br>NOTICE: This e-mail is intended for the named recipient(s). It may contain<br>privileged and/or confidential information. If you are not one of the<br>intended recipients, please notify the sender immediately and destroy this
<br>e-mail and attachment(s): you must not copy, distribute, retain or take any<br>action in reliance upon the email or attachment(s). While all reasonable<br>efforts are made to safeguard inbound and outbound e-mails, OAG Worldwide
<br>Ltd and its affiliate companies cannot guarantee that attachments are<br>virus-free or are compatible with your systems, and does not accept<br>liability in respect of viruses or computer problems experienced. Thank you.
<br><br>--<br>No virus found in this incoming message.<br>Checked by AVG Free Edition.<br>Version: 7.1.371 / Virus Database: 267.13.12/193 - Release Date: 06/12/2005<br><br>--<br>No virus found in this outgoing message.<br>
Checked by AVG Free Edition.<br>Version: 7.1.371 / Virus Database: 267.13.12/193 - Release Date: 06/12/2005<br><br><br>_______________________________________________<br>Beds mailing list<br><a href="mailto:Beds@mailman.lug.org.uk">
Beds@mailman.lug.org.uk</a><br><a href="http://mailman.lug.org.uk/mailman/listinfo/beds">http://mailman.lug.org.uk/mailman/listinfo/beds</a><br></blockquote></div><br>