Get value from one class to use it in another class (java)
<p>I have two classes</p>

<p>in class ABC</p>

<pre><code>double a = 0.5 
public double lala()
{
     return a;
}
</code></pre>

<p>I want use it in another class, let us say class DEF</p>

<pre><code>ABC abc;
double baba = abc.lala();
</code></pre>

<p>But it says that java.lang.NullPointerException, any idea? Thx</p>

<pre><code>public class AdapterDB 
{ 
        double cal;
    double rcarbohydrate;
    double rfat;
    double rprotein;

    public AdapterDB(double cal, double rcarbohydrate, double rfat, double rprotein, Context ctx)
    {
        this.cal = cal;
        this.rcarbohydrate = rcarbohydrate;
        this.rfat = rfat;
        this.rprotein = rprotein;
        this.context = ctx;
        DBHelper = new DatabaseHelper (context);        
    }

        public double Calorie()
    {
        return cal;
    }

    public double Carbohydrate()
    {
        return rcarbohydrate;
    }

    public double Protein()
    {
        return rprotein;
    }

    public double Fat()
    {
        return rfat;
    }

}
</code></pre>

<p>Here is my code for class ABC, and I want to use some of them at another class >_&lt;</p>
