For years we've all heard it — protect yourself from the sun and ultraviolet rays. Apparently many people are listening, though some folks still need to heed the message.

According to a study published in JAMA Dermatology, a medical journal, melanoma cases were drastically lower in younger people ages 10-29 from 2006 to 2015. However, the rate of melanoma cases increased overall and among older populations.

"Maybe that public health message is having a tremendous effect", said Margaret Madeleine of the Fred Hutchinson Cancer Research Center in Seattle. "And that if we keep following these younger cohorts as they age, we may no longer see this increasing trend in melanoma but in fact start to see a decrease. That’s our hope."

Researchers analyzed data from the US Cancer Statistics National Program of Cancer Registries for the study. Experts say one way to try and prevent melanoma is getting into good habits early.

"Having a melanoma once puts you at risk for having another melanoma separate from the one that’s just been diagnosed," said Dr. Jennifer Gardner, a dermatologist at the University of Washington School of Medicine. "So it’s not too late to continue to prevent, wearing those protective sun protective clothing, sunscreen, avoiding tanning beds at all costs and making sure that they’re regularly getting checked to make sure none of their other spots looks suspicious as well."

Melanoma is the fifth most common cancer among men and women in the country.

Copyright 2019 KTVA. All rights reserved.