Java - Parsing a text file with integers and strings
<p>I have a text file with the following contents (delimiter is a single space):</p>

<pre><code>1231 2134 143 wqfdfv -89 rwq f 8 qer q2
sl;akfj salfj 3 sl 123
</code></pre>

<p>My objective is to read the integers and strings seperately. Once I know how to parse them, I will create another output file to save them (but my question is only to know how to parse this text file).</p>

<p>I tried using Scanner and I am NOT able to get beyond the first inetger:</p>

<pre><code>Scanner s = new Scanner (new File ("a.txt")).useDelimiter("");
while (s.hasNext()){
System.out.print(s.nextInt());}
</code></pre>

<p>and the output is</p>

<pre><code>1231
</code></pre>

<p>How can I also  get other integers from both the lines?</p>

<p>My desired outout is:</p>

<pre><code>1231 
2134 
143
-89
8
3 
123
</code></pre>
