Washington (CNN) -- Comedian Bill Cosby received an honorary rank from the Navy Thursday, and he had a Washington audience laughing with stories from his four years in the service.
Cosby has been entertaining millions of people since the 1960s. Cosby, whose success as a stand-up comic and actor has influenced many over the past four decades, is perhaps best known for his role as Dr. Heathcliff Huxtable on the 1980s sitcom "The Cosby Show."
But he didn't always enjoy such success, and he said the U.S. Navy gave him what he needed, when he needed it most.
"I wasn't a bad boy, I was just sort of left to wander around," Cosby, who as a young man served as a hospital corpsman, told a Navy-packed auditorium.
The iconic comic was in town to be recognized as an honorary chief petty officer in the U.S. Navy.
"I want to welcome you to the ranks of the people that run the Navy, people that make the ships sail on time, the aircraft fly, the hospitals work," said Secretary of the Navy Ray Mabus, who received the same honor last year. "Bill Cosby has earned this."
Cosby joined the Navy in 1956 and after graduating from boot camp, went on to become a Navy hospital corpsman.
He told the crowd joining the Navy seemed like the best place for him "to die."
"I don't want to join the Army because I'll die in a foxhole in dirt...I don't want to be in the Marine Corp because you die before you get out of there," Cosby told the laughing crowd filled with Navy personnel.
The biggest laugh came when Cosby explained why he joined the Navy.
"I want to be in the Navy, because no matter how you die, you're in the middle of the ocean and it will wash out your underpants and that will make my mother very happy."
Just before Cosby thrilled the crowd with his famous story-telling delivery, he was presented with a Navy uniform, which he put on, and set of Navy anchor pins that were pinned on by Mabus and the most senior enlisted member of the branch, Master Chief Petty Officer of the Navy Rick West.
Cosby, who was honorably discharged from the Navy in 1960, said the one of the greatest moments in his life was graduating from Navy boot camp. The comedian, known for his clean acts that do not include profanity, struggled at boot camp, saying the vulgar language and yelling weren't for him.
It got so bad, he said, that he even wrote his mother a letter asking if she could get him out of camp. Cosby said he was called to the commander's office and told that his mother had written back. "My mother asked the company commander to please continue to do these things," Cosby said, sporting his new Navy uniform.
The 73-year-old star recalled that finishing Navy boot camp was the first time his mother saw him graduate from anything. Cosby didn't graduate from high school but later received a high school equivalency. After the Navy, Cosby went on to attend Temple University and he earned a master's degree and a doctorate in education at the University of Massachusetts.
Cosby served on the USS Fort Mandan, a Navy support ship that was based at facilities including the Naval Hospital in Bethesda, Maryland, where he helped in rehabilitation of wounded Korean War veterans.
Cosby said he earned $42 every two weeks in the Navy but the lessons he learned were priceless.
"I was eating for free and, as they say, (having) a place to lay your head was wonderful, lights out, lights on," Cosby said, telling his laughing audience that he learned discipline in the Navy, among other things.
"Urinate in one urinal and continue to do so in that same one -- discipline," he joked.
He then took a swipe at those who have never served.
"I have to tell you I have a problem with civilians...I still know a deck is better buffed by someone in the service, and cheaper."
The Navy crowd laughed again.