• Post Reply Bookmark Topic Watch Topic
  • New Topic

using scanner class with multi-dimension  RSS feed

 
Gbenga wale
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please can anybody put me throuugh how to use the two dimension in scanner class
 
Tim Cooke
Marshal
Posts: 4051
239
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The two dimension what?
 
Gbenga wale
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i mean multi-dimensional array
 
Paul Clapham
Sheriff
Posts: 22838
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, multi-dimensional arrays. So what does the Scanner class have to do with them?

(And neither of them is really a Spring topic. Let's move the thread to Beginning Java.)
 
Gbenga wale
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
am trying to create an application that will accept user inputs and store them inside two dimensional array
 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
accept user inputs and store them inside two dimensional array

If the 2 dim array contents are discussed as in rows and columns in each row, where do you want each item entered by the user to go?
For example: fill the columns on a row and move to the next row when all the columns on a row have values.
Or fill the first column for all the rows and move to the next column when all the rows are filled.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gbenga wale wrote:am trying to create an application that will accept user inputs and store them inside two dimensional array

OK, now we're getting somewhere...but we're still way short of a full explanation.

What are these inputs? Numbers? Text?

Is every "row" in your 2D array going to have the same number of columns?

Try to explain it to us as if you were explaining it to a smart child with no knowledge of Java:
What do they need to do?

There's more than one way to do this, but I suspect that, in explaining it to us, you'll probably work out how to do it yourself.

Winston
 
Gbenga wale
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sory for the late reply. It was due to power outtage in my area.
I thought I mentioned it that it is a dimensional array.
 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, where should the user's input be placed in the array?
 
Gbenga wale
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
inside a rectangular array..
Like a user will be asked to enter his firstname and lastname and username and password and it will be save inside an array. the rectangular array will be a size of 10 by 4. I.e. 10rows, 4columns.
 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like a user will be asked to enter his firstname and lastname and username and password

OK, I assume that would be an array of Strings.
What slot would be used for each item? For example 0,0 for firstname, 0,1 for lastname, etc.
If there is data for more than one person, where would the data go for each person? Would each person get his own row?

Use an assignment statement to put values into an array:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!