235 is the tread width and the 40 is the side wall height if im not mistaking
The 40 indicates that this tire size's sidewall height (from rim to tread) is 40% of its section width. The measurement is the tire's section height, and also referred to as the tire's series, profile or aspect ratio. The higher the number, the taller the sidewall; the lower the number, the lower the sidewall.
Taken from tirerack and changed the 50 to a 40 to be pertinent to this thread. Simply put, it's a ratio not an exact measurement like the width.
235/40/18........the 235 is width in millimeteres of the tire, 40 is aspect ratio between sidewall and width, i.e. it means that the sidewall is 40% of the 235 width. And the 18 is the size rim it will fit on
Keep in mind that your speedometer reads distance by the outside circumference of you wheel and tire combination, so if you change the diameter of the package your speedo will start telling you the wrong speed. Measure your stock rims and ensure your new package has the same diameter or have your speedometer recalibrated.