Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Dynamic Arrays  RSS feed

 
Katie Gray
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing a small program at introductory level in AWT . It is for a game which I would now like to implement difficulty levels into by selecting radio buttons. I had initially set the size of my arrays to 3, although I now want to go back and make the size inputtable by selection of a radio button. I have tried this by changing my array to char code[]=new char[chars] but I get an Array Out of Bounds Exception Error every time. Am I declaring these in the right place?

Help!!!
Thanks.
 
Tad Dicks
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you thought about trying to use an ArrayList? or a vector?

either of those sounds more appropriate (and may be easier to implement).

-Tad
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't sound AWT-specific to me. Moving to Java in General (beginner)...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!