dynamic object creation in java
<p>I have the below code.</p>

<pre><code>public class Test {
    public static void main(String args[])
    {
        int i = 0;

        if(i==0){
            Beer obj = new Beer();
        }
        else {
            Rum obj = new Rum();
        }
        System.out.println(obj.brand);  //doesn't work
    } }

class Drink {
} 
class Beer extends Drink{
    public String brand = "BeerBrand"; }

class Rum extends Drink{
    public String brand = "RumBrand"; }
</code></pre>

<ol>
<li>Is there an way to make the above work without using function overriding or dynamic class loading?</li>
<li>All classes are dynamically loaded in JVM there is no static loading like in C. Is this correct?</li>
</ol>
