is it expensive for the jvm to create class object from abstract class on the fly?
<p>I am trying to use template design pattern so I use abstract class to define my algorithm like this:</p>

<pre><code>abstract class MyTemplate
{
    public void execute()
    {
       //... do something
       doSomething();
    }
    public abstract void doSomethig();
}
</code></pre>

<p>In my code I will create an instanceof MyTemplate everytime like this:</p>

<pre><code>MyTemplate cleanUp = new MyTemplate()
{

public void doSomething()
{
// execute cleanup 
}
}
cleanUp.execute();
</code></pre>

<p>Is creating a object out of abstract class expensive for JVM?</p>

<p>Thanks,</p>

<p>Sean Nguyen</p>
