NullReferenceException: Object reference not set to an instance of an object in C#
<p>After the execution of code following exception occurred at the end of code, I have do a lot of changes in the code but nothing change at all. </p>

<blockquote>
  <p>NullReferenceException: Object reference not set to an instance of an object
  RocketController.Start () (at Assets/Script/RocketController.cs:10)</p>
</blockquote>

<p>What is the cause of this exception? </p>

<pre><code>using UnityEngine;
using System.Collections;

public class RocketController : MonoBehaviour {

// Use this for initialization
Rigidbody2D rd;
void Start () {

    rd.GetComponent&lt;Rigidbody2D&gt;();
}

// Update is called once per frame
void Update () {

    if(Input.GetKey("right"))
    {
        rd.velocity = new Vector2(1,0);
    }
    else if(Input.GetKey("left"))
    {
        rd.velocity = new Vector2(-1,0);
    }
    else
    {
        rd.velocity = new Vector2(0,0);
    }


  }//close update
}
</code></pre>