• Post Reply Bookmark Topic Watch Topic
  • New Topic

Questions about Array, Int, String  RSS feed

 
P. Larson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to do assignment 4 where the user type in a number 1-90. Then the out put would be the spelling of that number. So I have a couple of questions about array, int , strings.
(1) Is there a way to convert a int array to a string ? (2) How can I have user input with arrays ? (3) Could I convert a string array into a int ? (4) What is the best way to do this kind of program? This is my first time doing anything with an array. So Thank You for the help.
 
Ahsan Bagwan
Ranch Hand
Posts: 254
1
Java MySQL Database Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will take a stab at answering some of your questions. Here goes,

Is there a way to convert a int array to a string ?

Yes. See the Arrays class in Java API docs.

How can I have user input with arrays ?

I think Scanner is what you need. But for arrays you would have to use a loop as well.

Could I convert a string array into a int ?

Yes its possible. Check out the wrapper class for the primitive int.






 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!