Young people are less likely to turn to credit cards in difficult financial times than older generations, a recent study found. Above, millennial stock blogger and trader Rachel Fox, 20, took a selfie with a fan after speaking to a group of investors, tech nerds and stock traders at StockTwits annual Stocktoberfest in Coronado, California, Oct. 14, 2016. Reuters

Painting millennials as far more financially healthy than stereotypes would suggest, a new study from the consumer financial information site Bankrate released Thursday indicated that young people were far more likely to have a rainy day fund to rely on in case of an emergency, such as an unexpected hospital visit or car repair.

While only 41 percent of the thousand adults surveyed said they could pay for a surprise expense using money from their savings accounts, 45 percent of millennials said they could pull money from savings, compared to 39 percent of Gen Xers, 38 percent of those ages 50 to 64 and 42 percent of people 65 and older. Younger millennials were even more likely to have savings to dip into in hard times, with 47 percent of respondents saying they would have $500 to $1,000 to rely on.

“I think that millennials—the younger generations—are getting the messaging that it’s really important to have emergency savings to get your hands on,” Bankrate analyst Jill Cornfield said. She added that younger Americans have also absorbed lessons about the risks of ballooning debt associated with credit cards, to which they’re “very averse.”

Millennials were the least likely to rely on credit cards, with 12 percent opting for credit when paying for an emergency expenditure, compared to a fifth of Gen Xers, nearly a quarter of baby boomers and 27 percent of people past retirement age.

The results of the study, which had a margin of error of 3.7 percent, lined up with August findings from online brokerage TD Ameritrade, which found millennials more likely than baby boomers to save for emergencies, gifts, their children’s (or grandchildren’s) educations and large purchases of over $2,000. A February study by another online brokerage firm, Scottrade, on generational differences in retirement savings found millennials the most likely by far to put money away on a regular basis while working toward their savings goals.

As for how older generations can perhaps catch up to their younger counterparts when it comes to saving more, Cornfield emphasized the importance of planning and budgeting.

“Get a grip on your finances—set some goals, write it down… It doesn’t cost anything,” she said. “If it’s free, then you have a reason to do it.”