Retired Navy Admiral John S. McCain Jr., 70, a bluntly outspoken foe of communist aggression who served as commander-in-chief of U.S. forces in the Pacific at the peak of the Vietnam war, died Sunday of a heart attack he suffered while returning from a vacation trip in Europe.

Admiral McCain, retired since 1972, was the Navy's first full admiral who was the son of another full admiral. His father commanded a carrier task force in the Pacific during World War II. One of Admiral McCain's own sons, Capt. John S. McCain III, was a prisoner of war in Indochina for five years after being shot down while a Navy pilot.

The admiral was stricken on board an Air Force plane and was taken to Loring Air Force Base, Me., where he was pronounced dead.

A dedicated apostle of the importance of seapower to the national interest, Admiral McCain was a decorated World War II submarine commander. He headed U.S. forces in the Dominican Republic during the 1965 crisis there. From 1968 to 1972, he held the Pacific post, which included Vietnam.

"The communists have chosen to make Vietnam the testing ground for their so-called wars of national liberation," he once said. "If they can make this kind of aggression work there, we can expect to be faced with more such wars elsewhere. We are there to prove to them that it won't work."

Admiral McCain was born in Council Bluffs, Iowa, and grew up at various naval stations where his father was posted. He was in Washington during his high school years and graduated from the old Central High School before entering the U.S. Naval Academy at Annapolis in the class of 1931. He reported rebelliousness as a midshipman was said to have earned him huge dose of punitive extra duty.

Of his later return to the Naval Academy to teach electrical engineering, he said, "The lads learned soon enough never to try to hoodwink and old hoodwinker."

In a 1970 speech he told the academy's graduating class not to worry about those urging "make love, not war." The graduates, he said, belonged to a fraternity "whose members are men enough to do both."

As commander of three different submarines during World War II, he sank 20,000 tons of Japanese shipping and once spent 72 hours on the ocean bottom, riding out a depth charge attack. "It gives you a new outlook on life," he said of the experience. His military decorations from the period included the Silver Star and Bronze Star medals.

After the war, the lithe, slightly built admiral, who jumped rope 200 times a day to help keep fit, held a variety of posts, including second in command of the heavy cruiser St. Paul during the Korean conflict, chief of Navy congressional liaison, chief of information for the Navy, commander of the Atlantic amphibious training command, commander of Atlantic amphibious faorces, and before going to the Pacific, Naval commander in Europe.

In addition to the Silver and Bronze Stars, Admiral McCain's decorations included two Distinguished Service Medals and three Legion of Merit medals.

He was a 33rd degree Mason and a member of the Comos, Army & Navy and Chevy Chase clubs.

In addition to his son John S. III, of Washington, survivors include his wife, Roberta, also of Washington, another son, Joe, of Bethesda; a daughter, Mrs. Henry Morgan of Houston; a brother, Gordon, of Corcoran, Calif., and a sister, Catherine, of Coronado, Calif.

The family suggests expressons of sympathy be in the form of contributions to the Navy Relief Society.