title: Cannot find symbol error _ PrintWriter.printf() method _
body: <p>I am trying to write formatted text into a file with a <code>PrintWriter.printf()</code>.   </p>
  
  <p>When compiling on <strong>ubuntu(Java version is 1.6.0_41)</strong> I get the error : </p>
  
  <pre><code>cannot find symbol method printf(java.lang.String, int) 
  </code></pre>
  
  <p>I tried with the method <code>printWriter.format ()</code> but gives the same error.   </p>
  
  <p>On <strong>Windows(where Java version is 1.8.0_162)</strong> it works.    </p>
  
  <p>Here's the method containing the error:</p>
  
  <pre><code>public void fileWriting(TestSerialMsg message) throws IOException {
  
      FileWriter fileWriter = new FileWriter("ReceivedMsg.txt");
      PrintWriter printWriter = new PrintWriter(fileWriter);
      printWriter.print("Some String");
      printWriter.printf("received counter is %d",message.get_counter());
      printWriter.close();
     }
  </code></pre>
  
  <p>The error :</p>
  
  <pre><code>TestSerial.java:85: cannot find symbol
   symbol  : method printf(java.lang.String,int)
   location: class java.io.PrintWriter  
       printWriter.printf("received counter is %d",message.get_counter());  
                  ^  
   1 error
  </code></pre>