File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes How to enter whole row of elements into 2d array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to enter whole row of elements into 2d array" Watch "How to enter whole row of elements into 2d array" New topic
Author

How to enter whole row of elements into 2d array

Kyle Wettengel
Greenhorn

Joined: Feb 06, 2013
Posts: 14
I'm experimenting with arrays and while I can figure out how to enter the elements of a 2d-array based on user input I cannot figure out how to prompt the user to separately enter entire rows of the 2d-array (with a space in between each number) rather then entering each number then pressing enter. Could I get some help here? I know this will be on my next test, thanks guys!

Here's my code:

Joel Christophel
Ranch Hand

Joined: Apr 20, 2011
Posts: 225
    
    1

Kyle Wettengel wrote:
System.out.println(isConsecutiveFour(array));


Is this all of your code? Where's the isConsecutiveFour() method defined?

EDIT:
Here, I added a couple of lines so that the information for each row is prompted and then printed out.

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36478
    
  16
Java does not support 2D arrays. What you have is an array of arrays.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to enter whole row of elements into 2d array
 
Similar Threads
Multi dimensional arrays
2d Array problem gasprices
using for loops in calculations
Convert array to array of arrays
2d arrays help