Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please help! if you can :)

 
drew taylor
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic