• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to enter whole row of elements into 2d array

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:

 
Ranch Hand
Posts: 250
1
Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.

 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java does not support 2D arrays. What you have is an array of arrays.
 
reply
    Bookmark Topic Watch Topic
  • New Topic