how to reference a UI element in unity

Code Example - how to reference a UI element in unity

                
                        //By declaring the object with the Text Object Type
public Text playerName;