File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Array list help. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Array list help." Watch "Array list help." New topic
Author

Array list help.

Frank Espinoza
Greenhorn

Joined: Jan 31, 2011
Posts: 3
I need to prompt a user to enter his name and then address the user by name, afterwards I need to prompt for 20 more names and then stored the names as an array list. I can get the first part but I'm not sure how to prompt for the other names and save them.. I would greatly appreciate any advice.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19759
    
  20

Can you show us the loop you've written?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Nico Van Brandt
Ranch Hand

Joined: Mar 31, 2011
Posts: 66

Just push the names in the arraylist?

Pseudo code:

Initialize ArrayList
Prompt username
Display Hello, username!

Loop 20 times
Prompt for username
ArrayList.Add(username) // Somewhat less pseudo-ish ;)
End Loop


Oracle Java SE6 Certified Programmer
Oracle Java EE5 Certified Web Component Developer
Frank Espinoza
Greenhorn

Joined: Jan 31, 2011
Posts: 3
I'm sorry about the late response, but this is what I have so far:
<body>
<script type="text/javascript">
var name=prompt("Please Enter Name");
alert("hello" + name);
document.write(name.length);
document.write(word.touppercase ());
</script?


Nico Van Brandt
Ranch Hand

Joined: Mar 31, 2011
Posts: 66

hmm yeah..
that's not Java but Javascript
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14338
    
  22

JavaScript is something totally different than Java. They have similar names only because of an unfortunate historical accident...

Java's ArrayList doesn't exist in JavaScript.

So, do you want to do this in JavaScript or in Java?

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Nico Van Brandt
Ranch Hand

Joined: Mar 31, 2011
Posts: 66

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Array list help.