how to make a 3d object do something when clicked on

Code Example - how to make a 3d object do something when clicked on

                
                        using UnityEngine;
 using System.Collections;
 
 public class OnMouseDownExample : MonoBehaviour 
 {
     void OnMouseDown()
     {
         print (name);    
     }
 }