What am I doing wrong in this code in Java?
<p>I have been having problems with this part of my assignment. The problem asks to write the mean in another file but when I see the results in the other file the mean shows a question mark where the means answer is supposed to be. The only problem I have is the code inside the while loop everything else seems to be working. Can anyone please tell me what im doing wrong?</p>

<pre><code>File file = new File (filename);
Scanner inputFile = new Scanner (filename);

filename = inputFile.nextLine();


while(inputFile.hasNext())
{
   double number = inputFile.nextDouble();
   sum =  number + sum;
   count++;
   line = inputFile.nextDouble();
}
inputFile.close();
mean = sum / count;
</code></pre>
