The Massachusetts senator , who was first elected in 1962 , underwent surgery in June for a malignant brain tumor .