Even long-term investors have to reevaluate their positions and occasionally offload some companies' shares. But some corporations look solid enough that they are hard to part ways with regardless of the economic environment. That depends on each investor's preference, of course.

For me, there are at least three stocks in my portfolio I don't anticipate getting rid of anytime soon: Johnson & Johnson (JNJ -0.46%), Meta Platforms (META 0.43%), and Amazon (AMZN 3.43%). Here is why. 

1. Johnson & Johnson

Johnson & Johnson needs no introduction -- it has been a leading healthcare company for a long time. Although that's no guarantee of the future, there are several reasons why I am confident that the drugmaker can still produce solid returns from here on out. Let's consider just three. First, J&J is an innovator -- it spends enough money on R&D expenses to routinely develop newer and better drugs and medical devices, two segments of the broader healthcare market in which it is deeply entrenched.

Second, we can point to Johnson & Johnson's solid fundamentals. Perhaps the best evidence of that is the company's AAA rating -- it is just one of the rare publicly traded corporations with a higher credit rating than the U.S. government itself. Johnson & Johnson did not earn this high honor by chance. It directly results from its strong balance sheet and consistent financial results over long periods.

Third, Johnson & Johnson distributes one of the safest dividends on the market. It has been increasing its payouts for 61 consecutive years, so it is a Dividend King. The past six decades have seen several market crashes and recessions, and despite these issues, J&J has continued to reward shareholders with dividend increases -- an impressive feat.

Although Johnson & Johnson has encountered legal headwinds, the company's excellent business gives me confidence as a shareholder that it can deal with the lawsuits it currently faces. So unless something catastrophic happens, I anticipate I'll remain a shareholder for good.

2. Meta Platforms 

Meta Platforms owns a portfolio of websites and apps that are among the most visited and downloaded in the world. The company has built a competitive edge thanks to its vast ecosystem, namely the network effect. The value of its services increases with use. Instagram provides a good example. People use the platform for various reasons: connect with friends, advertise their businesses, etc. The more users Instagram has, the more valuable it becomes to those ends.

As of the second quarter, Meta Platforms had 3.88 billion monthly active users, an increase of 6% year over year. That's nearly half of the population of the entire Earth that visits at least one of Meta Platforms' websites at least once a month. No wonder advertisers are attracted to the company's ecosystem like a moth to a flame. And although the ad market has struggled over the past year, it now seems to be rebounding.

More importantly, Meta Platforms can find more and more ways to monetize its users. It is currently attempting to do so on WhatsApp, which has arguably lagged the rest of its business in terms of monetization. But Meta Platforms is now making revenue from paid messaging and business messaging on the app. Meta Platforms could become an e-commerce hub over the long run as well, and it is still working on its ambitious metaverse project.

Meta Platforms has become such an integral part of people's lives that it is difficult to see that changing anytime soon. That, combined with the company's innovative potential, is why its business and financial results should remain strong for a long time. I am staying put. 

3. Amazon 

From its humble beginnings as an online bookseller, Amazon is now one of the leading technology companies, with a market cap of $1.4 trillion. The tech giant pulled that off largely thanks to a management team that wisely identified and strategically pursued exciting growth opportunities. That's how Amazon became the leader in e-commerce and cloud computing. The company is no longer led by its iconic founder and former CEO, Jeff Bezos.

But the blueprint he left behind should allow Amazon to continue doing much of what has made it successful. E-commerce still has miles of growth left, as even in the U.S., most retail activity happens offline. In the first quarter, e-commerce sales accounted for 15.1% of total retail sales in the country. E-commerce hasn't peaked yet, in all likelihood. Amazon will also benefit from cloud computing, where there is ample growth space left.

The company is looking at other opportunities, including generative artificial intelligence and healthcare. One of Amazon's biggest strengths is its competitive advantage, which it derives from several sources. The company boasts one of the most valuable brand names in the world, its e-commerce platform displays the network effect, and its cloud computing solutions arguably benefit from high switching costs.

And, of course, Amazon's consistent revenue, earnings, and cash flow give it the funds to invest in plenty of other opportunities. Amazon's economic moat, proven innovative abilities, and multiple growth avenues make its stock worth owning forever, at least for me.