aspose file tools*
The moose likes Beginning Java and the fly likes Please help! if you can :) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Please help! if you can :)" Watch "Please help! if you can :)" New topic
Author

Please help! if you can :)

drew taylor
Greenhorn

Joined: Feb 20, 2006
Posts: 21
Hi, I am new to java and I was hoping somebody could explain how to do the following or provide me a code snippet - any help would be appresiated

I need a method that can loop and prompt the user to enter 2 numbers as int.

Would I use the scanner class to get the user input? Then I need to add them to an ArrayList which can store the two numbers, loop and output the values.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14338
    
  22

Class java.util.Scanner would indeed be suitable for this. Have a look at the documentation for it and see if there are some methods you can use. Also have a look at the documentation for class ArrayList.

You can find a link to the API documentation in by signature below.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by drew taylor:
Hi, I am new to java and I was hoping somebody could explain how to do the following or provide me a code snippet...

We're here to help, but you need to show some effort (especially on homework-type questions). So try writing your own snippet, tell us where you're stuck, and we'll help you figure it out.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please help! if you can :)