 McCain graduated from the Naval Academy in June 1958 ; he was fifth from the bottom in class rank , 894th out of 899 . Despite his difficulties , McCain later wrote that he never defamed the more compelling traditions of the Academy – courage , resilience , honor , and sacrifice for one 's country – and he never wavered in his desire to show his father and family that he was of the same mettle as his naval forebears . Indeed , Slew and Jack McCain had not had sterling records at the Academy themselves , finishing in the bottom third and bottom twentieth respectively . McCain realized later that the Academy had taught him that " to sustain my self @-@ respect for a lifetime it would be necessary for me to have the honor of serving something greater than my self @-@ interest " , a lesson that he would need to carry him through a " desperate and uncertain " time a decade later . 
