No right or wrong way.
i would say 401k is probably the "Safer" or more conservative approach and is also a lot easier which is why it is so popular. For the avg joe six packs its nice to just have 10-15% auto deducted from your paycheck, dont even think about the market and 30+ years later when you retired you can cash out and live your golden years comfortably. The problem with a 401k is you are limited to $18,000 in contributions per year. Even if you max out your your contributions from day one and work for 35 years, assuming a 7% growth rate and 2% inflation rate you are only looking at about 1.4 million in present worth dollar. They key to retiring with stock investments is to get enough value built up that you can just live off of the interest and not touch the principal, allowing you a never ending source of income without doing anything and when you die it allows you to give a large inheritance to your heirs.
Buying investment properties, be it for flipping or long term renting is significantly more work and carries quite a bit more risk, however, the reward can be significantly higher. Good investors can see as high as 20% ROI when it comes to rental properties and eventually you also end up with the equity in the property once paid off along with an indefinite source of revenue. If you acquire enough properties it can actually be cost effective to hire someone to manage them all for you. Sure that reduces your profit, but instead of cutting grass, collecting rent, etc... you can wake up and just go golfing, shooting, take a trip to Jamaica, and the money just keeps coming in.
Ideally do both. Max out your 401k then save up and buy investment properties. Just remember money is made on the purchase, not the sale and be careful in the housing market, its a sellers market right now so deals are difficult to find. Im personally banking cash and waiting for the next recession to hit, where I will buy single family homes for pennies on the dollar and turn into rental properties.