Many people feel too intimidated to invest in stocks. It is scary to commit your hard-earned money when you have the chance to lose some or even all of it. But while stocks can fluctuate over the short run, they have produced higher returns than other investments such as U.S. government bonds. In other words, you get paid for the higher risk.

So if you are ready to make a long-term commitment, putting your cash into stocks can prove lucrative. The question comes down to which companies to invest in.

Below are two companies that are good "starter" companies. They are solid companies that do well in a variety of economic environments, have strong balance sheets, and pay increasingly higher dividends.

A man reading a book called Investing For Beginners.

Image source: Getty Images.

Johnson & Johnson

Johnson & Johnson (JNJ -0.69%), founded in the 1860s, is one of the world's most successful companies. It operates three businesses: consumer, pharmaceutical, and medical devices.

Its consumer division includes products that encompass a wide range of areas such as over-the-counter medicines, baby care, women's health, and wound care. These include popular brands like Band-Aid, Neutrogena, Motrin, and Stayfree. Johnson & Johnson's pharmaceutical segment produces drugs to treat conditions such as various kinds of cancers. Finally, its medical devices business has products used in various fields such as surgery and orthopedics.

This is truly a global company with nearly 50% of its sales coming from outside of the U.S. That helps Johnson & Johnson offset weakness in one particular geographic region.

Its recent results show the company's resiliency. While Johnson & Johnson's sales were hurt by COVID-19 earlier this year, the company's third-quarter adjusted sales were 2% higher compared to a year ago.

While this isn't great, sales are headed in the right direction and with strong, well-regarded products, no one should worry about the long-term trajectory. In 2019, before the virus impacted everyday life, its adjusted sales were 4.5% higher year over year.

You can count on the company raising dividends, too. Earlier this year, it improved its annual streak to a remarkable 58 years (making Johnson & Johnson a Dividend King) when the board of directors hiked the quarterly payment by 6% to $1.01. The dividend yield is 2.7%.

Walmart

Walmart's (WMT 1.32%) business is simply to watch costs carefully to keep prices down for its customers. This certainly strikes a chord with shoppers. Since opening its first discount store nearly 60 years ago, it is now the world's largest retail company. There are over 265 million customers shopping at its physical and digital stores every week.

Selling basic items at low prices is particularly appealing to customers during an economic slump, too. In its fiscal third quarter, which ended on Oct. 31, same-store sales (comps) at its Walmart U.S. stores rose by 6.4%.

The company is also investing in digital initiatives. These were a major factor in the comps improvement, representing about 90% of the increase. Part of its omnichannel approach includes launching its subscription service, Walmart+, a few months ago. Directly taking on Amazon's Prime service, Walmart's offering provides fast delivery on many items, a smoother checkout process at its stores, and discounts on gas.

This is another company with a sterling dividend track record. While not quite a Dividend King yet, it is on track to join that group in a few years. Walmart's dividend yield is 1.5%.

These are not the fastest growing companies, but they do provide steady revenue and profitability increases. When you add in predictable dividend raises, these make for good first-time investments that you can hold onto for a long time.