A theoretical study was conducted to investigate the wetting behavior of liquid meniscus on a vertical plate with three-dimensional random characteristics of heterogeneity and roughness. The thermodynamic stable condition was derived by considering the minimum of system free energy. The local stable condition leads to a result similar to that obtained for a plate with two-dimensional characteristics, that is, the system has many meta-stable states. For the stable condition of the whole system, a relation was derived between the macroscopically observed contact angle and the surface characteristics. The product of cosine of the contact angle and liquid surface tension is equal to the energy difference for the liquid to wet the plate by apparent unit area. If the liquid wets the solid surface reversibly, there is only one contact angle observed macroscopically. This fact suggests that the contact angle hysteresis is caused by the irreversible motion when the liquid advances or recedes on the solid surface. The well-known Cassies and Wenzels contact angles are explained as those corresponding to a thermodynamically stable condition when the liquid wets the solid reversibly.