What should I use instead of rigidbody2D?

Unity 5 is giving me compiler errors when I upgraded a project from Unity 4. It doesn’t want me to use the rigidbody2D function, and tells me to use GetComponent but I’m not sure exactly how to go about it.

How can I get these 2 obsolete lines of code to work in Unity 5?

rigidbody2D.velocity = new Vector2 (0f, 0f);
rigidbody2D.AddForce (force * new Vector2 (x, y));

// Use GetComponent to get a reference to the rigidbody2D component
Rigidbody2D rigidbody2D = GetComponent();

rigidbody2D.velocity = new Vector2 (0f, 0f);
rigidbody2D.AddForce (force * new Vector2 (x, y));

You should check out https://unity3d.com/learn/tutorials/modules/beginner/scripting/getcomponent