Answer:
James Cook gained his military experience during the Seven Years' War (1756-1763), also known as the French and Indian War in North America. Cook joined the Royal Navy in 1755 and was soon sent to North America, where he served as a master's mate aboard HMS Pembroke. Cook quickly distinguished himself as a skilled navigator and surveyor, and he was soon given his own ship to command. During the Seven Years' War, Cook served in several major naval engagements and was involved in the capture of several French vessels. Cook's military experience during the war helped to shape his later career as an explorer, and he used his navigational and surveying skills to chart new territories and expand the British Empire.