Thank you for you patience I finally have it!
Type: Posts; User: hiro
Thank you for you patience I finally have it!
static void readArray(String fileName) throws FileNotFoundException {
Scanner s = new Scanner(new File(fileName));
ArrayList<Integer> ArrayInt = new ArrayList<Integer>();
while(s.hasNext())...
while(s.hasNext())
{
if(s.hasNextInt())
ArrayInt.add(s.nextInt());
else
s.hasNext(); // from here on restart the loop?
}
Out.println(ArrayInt);
Hello, I am not sure how to read Integer values from a textfile that has "strings" and "ints" . I want to save strings in an array and int in an array so I can use them later on.
For example, ask...