Hi, my problem is, i know how to create an array of Strings, BUT, how can i import a file into the string array?
Code Java:
SO, the string [] deck..i would like to import the (InputCards) into it
any help?
Printable View
Hi, my problem is, i know how to create an array of Strings, BUT, how can i import a file into the string array?
Code Java:
SO, the string [] deck..i would like to import the (InputCards) into it
any help?
i thought of
but it keeps returning ( deck = deck[card]; ) this type of expression, "java.lang.String", is not numericCode Java:while (InputCards.eof () != true) { card = InputCards.readString (); deck = deck[card]; }
You must keep track of the current index - you cannot access an array index using a String object
In Pseudo-code
Code Java:int counter = 0; while ( ... ){ card = InputCards.readString (); deck[counter] = card; counter++; }
Try using a scanner!
You need a counter to keep track of where you are.Quote:
Originally Posted by Jason
counter++ increments itself by 1.