Java constructors for side-effects only
<p>I have a Java instance class, "ResultMaker" that exists for side-effects only (sending an email) and the object is never subsequently used.  (Of course this could be re-written so that ResultMaker is a static class, but when I add "flesh" to the class, adding methods and making multiple instances, I think I would eventually want to have a reference to the object, so my justification for declaring ResultMaker as an instance class at this stage is that the code is not finished yet.)  </p>

<p>In order to clean up a Java warning that <code>r</code> was unused (see the short example code), I removed the assignment to variable <code>r</code> (see code) so I was left with only a <code>new ResultMaker(ans)</code>.  The side-effect stopped happening with the code change so I guess instantiation of ResultMaker no longer happens.  Is this deserving of a compiler warning (that there will be no instantiation) or is this a well-known aspect of Java?</p>

<pre><code>    public void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws IOException, ServletException 
    {
        Thing tt = new Thing();
        String answer = tt.DoSomething();

        ResultMaker r = new ResultMaker(answer);

        resp.getWriter().println(answer);
    }
</code></pre>
