How to set object elements correctly in java? : <p>I have a constructor:</p>

<pre><code>    private String name;
    private int price;  
  public Fruit (String name, int price){
        this.name = name;
        this.price = price;

        System.out.println("NAME/PRICE SET");       
        if (getCheapestFruit() == null){
            setCheapestFruit(name, price);
            System.out.println("CHEAPEST NAME/PRICE INITIALIZED");
        } else {
            if(getCheapestFruit().price&gt; price){
                setCheapestFruit(name, price);
                System.out.println("CHEAPEST NAME/PRICE SET");
            }           
        }
    }
</code></pre>

<p>And I want to set the cheapestFruit.</p>

<pre><code>public Fruit cheapestFruit = null;
public Fruit getCheapestFruit(){
    return this.cheapestFruit;
}
public void setCheapestFruit(String name, int price){
    this.cheapestFruit.price = price;
    this.cheapestFruit.name = name;
}
</code></pre>

<p>And this die at  <code>this.cheapestFruit.price = price;</code> with null pointer exception. How can I set it correctly?</p>
