title: Would writing an image using Image class or the class BufferedImage class work in the same way?
body: <p>Here are my two implementations. Would both give the same result? I know that <code>BufferedImage</code> is the child class of the Image.</p>
  
  <ol>
  <li><p>First implementation: <code>writeImage</code> takes an <code>Image</code> Object and uses <code>RenderedImage</code> in the <code>ImageIO.write</code> method.</p>
  
  <pre><code>public void writeImage(Image img, String outputFile) {                  
      try {
          ImageIO.write((RenderedImage) img, "jpg", new File(outputFile));
      } catch (IOException e) {
      }
      ...
  </code></pre></li>
  <li><p>Second Implementation: <code>writeImage</code> takes a <code>BufferedImage`` object and uses the BufferedImage</code> object in the<code>ImageIO.write</code> method.</p>
  
  <pre><code>public void writeImage(BufferedImage img, String outputFile){
      try {
          ImageIO.write(img, "jpg", new File(outputFile));
      } catch (IOException e) {
      }
      ...
  ...
  </code></pre></li>
  </ol>
  
  <p>Also, try to tell what's the difference between the two ways of writing an image.</p>