• 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

to read intgers into program

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hye, i'm not quite able to figure this out, if someone can help by showing some example code :
i wanna enter integers into the variables from console after running program,am unable to do it with readInt(), also the input speciication is a space between integers. which are then taken as row and column of an int array.

p.s :pl reply ASAP, have been sitting on this too long.
 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using main method in your program?
If yes,then you can use following code :-

Does this help?
 
chintan chainani
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks jitesh that worked fine on the command line, but what i was looking for is the how does the program with main() , prompt user to enter the numbers, after program is run.
let me just print the whole problem : (maybe this will belong to java beginner,but since you replied I will just type it here..thanks)
REMOVAL OF 'ZERO ROWS AND COLUMNS IN A MATRIX.
given an integer matrix of size, say, M x N, to write a program to remove all the rows and columns consisting of all zeroes.
INPUT SPECIFICATION:
the first line of input will have 2 integers , say M and N, separated by a space, specifying number of row and column in matrix.
This will be followed by M LINES, EACH consisting of N integers.
assuming M and N can be between 1 and 10 only.

/*now i have got the logic for the program but am a little (or majorly)confused with input classes . So if you or someone could please help me with this ....
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic