The healthy habits people adopt and stick with in their 20s and 30s have a massive and direct impact on their risk of a heart attack or stroke decades later, a landmark study says.

Young adults who fail to keep heart-healthy practices can see their risk of future heart disease skyrocket by as much as 10 times as they age, compared to those who maintain their healthy habits, researchers reported Monday in JAMA Network Open.

"Change matters: Improvements in heart health can decrease future risk, and the earlier it is attained and maintained, the better, " senior researcher Dr. Donald Lloyd-Jones, a professor of medicine at Boston University School of Medicine, said in a news release.

"We hope that young adults will focus on their heart health as soon as possible, in order to gain the biggest dividends in longer, healthier lives," he added.

For the study, researchers tracked more than 4,200 adults participating in a long-term study of heart health. The participants joined the study in 1985 and 1986, when they were 18 to 30 years old. They were followed for 20 years.