title: Java: I want to read from a file, character by character, and save each char into an array that has a max size of 10
body: <p>this is my code:</p>
  
  <pre><code>    //array way
      char [] name = new char[10];
  
      while(input.hasNextLine()){
          firstName = input.next();
  
          for(int j = 0; j &lt; name.length(); j++){
              name [j] = name.charAt(j);
          }
          for(int i = 0; i &lt; name.length; i++){
                  System.out.println(name);                
          }
      }
  </code></pre>
  
  <p>my inFile is in this format (name, social security number, then 4 grades):</p>
  
  <pre><code>SMITH 111112222 60.5 90.0 75.8 86.0
  </code></pre>
  
  <p>i have the variables initialized already, so thats not the problem. the overall goal for the name part is to read the file character by character, and save each char into an array with a max size of 10 (ie. only the first 10 letters of the name get saved). then i want to print that array.</p>
  
  <p>the output is:
  prints out SMITH 10 times, then the SSN 10 times, then instead of erasing the SSN, it overwrites the first 4 characters and replaces them with the grade</p>
  
  <pre><code>60.512222
  </code></pre>
  
  <p>and does that 10 times and so on. i dont know why it does this or how to fix it. can someone help plz?</p>
  
  <p>ps. this is my first post here. plz tell me if im not posting efficiently</p>