Reddit stocks get a bad rap. Sure, the social media platform where retail investors sometimes swap stock tips has helped spur the curious multiple rises and falls of GameStop, AMC Entertainment, and Bed, Bath and Beyond.

But if you look at the list of most-discussed stocks over the past 24 hours, the names are quite conventional. Sure, there are plenty of dubious names on the list, but you'll also find a few stocks that are great long-term investments, or as Reddit users and cryptotraders like to say, "HODLS."

Two of the more surprisingly solid choices on that list are Johnson & Johnson (JNJ -0.69%) and Microsoft (MSFT 0.37%).

Why J&J is a great long-term investment

Johnson & Johnson's shares are up 4% over the past 12 months, which is a big improvement over the S&P 500 average's 17% drop.

The healthcare giant operates in four segments: consumer healthcare, medtech, pharmaceuticals, and its worldwide category. However, J&J has decided to narrow its focus in the hopes of becoming more profitable. Consumer healthcare, the only underperforming segment, is being spun off into a separate company called Kenvue sometime next year.

Johnson & Johnson has shown itself to be largely recession resistant. The company just reported its third-quarter earnings on Tuesday. Even in an environment of inflation and supply chain woes, the company listed revenue of $23.8 billion, up 1.9%, and earnings per share (EPS) of $1.68, up 22.6%. Over the past 10 years, J&J has increased revenue every year except for 2015.

The company is also diligent in rewarding investors. It has spent $2 billion this year on share buybacks, with another $3 billion scheduled. It has also paid investors $3 billion in dividends. The Dividend King has raised its payout for 60 consecutive years, including a 6.6% push this year to $1.13 per share, giving the dividend a yield of around 2.7%, well above the S&P 500 average of around 1.82%.

It's easy to be bullish on the long-term chances for the company, which trades at roughly 24 times earnings.

Why Microsoft is a great long-term investment

Microsoft's shares are down more than 22% over the past 12 months, due in great part to investors souring on tech stocks in general. But it's also due to a sluggish market for personal computers, with more people returning to the office as the COVID-19 pandemic ebbs.

The share drop doesn't bother me as the company's financials have weathered the past year well. The company's revenue sources are more well-rounded than just PC sales, with its cloud computing, Xbox sales, LinkedIn advertising revenue, and other revenue streams on the rise.

In its fourth-quarter fiscal 2022 report, revenue totaled $51.9 billion, up 12% year over year; net income came in at $16.7 billion, up 2%; and EPS was $2.23, up 3%. Investors have grown accustomed to better growth, however, which is why the stock has slid.

If you drill down, though, you can see that while revenue from its personal computing segment was $14.4 billion, only up 2%, many other segments saw double-digit gains. LinkedIn's revenue was up 26%, dynamic products and cloud services revenue was up 19%, intelligent cloud (Azure and Office 365 commercial) revenue was up 20%, and server products and cloud services revenue grew 22%.

Before we get too rosy about the company's chances, note that Microsoft did see the need recently to lay off 1,000 employees. While that's a small portion of the company's overall head count of 221,000, the move suggests the company is preparing for a longer tech recession.

However, that's more of a short-term concern as the key for Microsoft's growth will be continued innovation in cloud services, which offer extraordinarily high gross margins of 70% or more. Its consumer products may be affected in the short term by inflationary pressures, but much of what the company does isn't direct-to-consumer, but business sales such as its productivity software and cloud operating systems -- and those don't appear to be likely to slow down anytime soon.

Microsoft raised its dividend this year by 10% to $0.68, the 10th consecutive year it has increased its dividend since it began doling one out in 2013, giving it a yield of around 1.1%. While the company isn't a Dividend Aristocrat, it has boosted its dividend by 196% over the past decade.

With the drop in the stock's price, a price-to-earnings ratio of 24, and strong free cash flow (up 60% in just the past three years), Microsoft makes a great long-term buy.