According to some data, there have been eight recessions in the U.S. since 1965. Some experts think there could be another one this year, which would complicate matters for consumers and investors alike. Interestingly enough, 1965 was also the year Warren Buffett took over Berkshire Hathaway. Despite facing an more than a few economic downturns, the legendary investor has beat the market in that time period.

So, taking some inspiration from the Oracle of Omaha is a great place to start for those looking to navigate the next recession as smoothly as possible. With that said, here are two stocks, some of whose shares are owned by Warren Buffett's Berkshire Hathaway, that are ideal to recession-proof any portfolio: Johnson & Johnson (JNJ 0.60%) and Apple (AAPL 0.38%).

1. Johnson & Johnson

Johnson & Johnson is a major pharmaceutical and medical technology company that generates consistent revenue and profit. The healthcare giant has an impeccable track record with a history of innovation that dates back more than 100 years. Today, Johnson & Johnson continues to market dozens of medicines that are incredibly important -- sometimes lifesaving -- for patients. 

This is not an area where customers will cut back, even during an economic recession. Similarly, Johnson & Johnson's portfolio of medical devices in eye care, surgery, and orthopedics meets a critical need that doesn't simply stop due to economic problems. Even during the worst of the pandemic, when healthcare facilities were swamped with COVID-19 patients, many surgeries that couldn't be performed as a result were merely postponed. 

The company recently reported that procedure volume is recovering and will continue to do so, boosting its medtech business. Meanwhile, Johnson & Johnson will continue to innovate. The company boasts nearly four dozen programs in its phase 3 pipeline alone and many others in earlier stages of development.

The drugmaker routinely adds new products to its lineup or earns new indications for existing ones. That's one way the company's revenue and earnings can continue growing. Additionally, Johnson & Johnson is an excellent dividend stock. It's raised payouts for a staggering 60 consecutive years, which makes it a Dividend King. There aren't many companies with a better track record.

Reliable dividend-paying companies like Johnson & Johnson don't suspend or slash their dividends during challenging times. And the regular cash payments they offer can help smooth out market losses. Naturally, Johnson & Johnson faces some risks, most notably those related to the thousands of lawsuits linked to its talcum-based products, which allegedly caused cancer.

However, even a somewhat plausible worst-case scenario with the outcome of these lawsuits wouldn't be the end for Johnson & Johnson, although it would eat into its profits in the short term. Investors should look past this issue because of the company's robust balance sheet.

With a AAA credit rating from Standard & Poor's, the highest rating possible, Johnson & Johnson has the funds to take care of its obligations, be it during a recession or following an adverse outcome in a trial. In short, the drugmaker is a robust company that can help investors navigate any economic environment. 

2. Apple

Apple has been one of Warren Buffett's favorite stocks for a while. It's not hard to understand why. The tech giant has a solid competitive edge that largely relies on the strength of its brand name, which is highly regarded. Customers are so loyal to Apple that even during difficult economic times such as last year, they continue to buy the company's nonessential and rather expensive products at an impressive rate, despite the presence of multiple cheaper alternatives. 

That doesn't mean Apple is completely immune to economic challenges. The company's net sales in the first quarter of its fiscal year 2023 (ended on Dec. 31) decreased by 5.47% year over year to $117.2 billion. Apple's diluted earnings per share decreased to $1.88, down from $2.10. Still, Apple's top line increased for most of last year until the December quarter.

And at any rate, generating more than $100 billion worth of sales, mainly from high-end products is nothing to sneeze at. All those sales have led to another exciting development for Apple: The company now has an installed base of more than 2 billion devices worldwide.

This represents the future for Apple as it will seek to develop novel ways to monetize this massive customer base. It already does so through its high-margin services segment. And the company is constantly looking for new growth avenues, including within the healthcare sector. Given Apple's knack for innovation, we can confidently expect it to develop newer and better ways to serve its clients and generate even higher profits. 

With a solid business, strong moat, and attractive long-term opportunities to monetize its massive userbase, Apple is an excellent company to help investors weather tough economic challenges.