Let D be an integer. Consider the elliptic curve E/ℚ : y2 = x3 + D, which has j-invariant 0. We can show that for this elliptic curve the rank of its 3-Selmer group is closely related to the 3-rank of the ideal class groups of the quadratic fields ℚ(√D) and ℚ(√-3D). For the same family of curves Frey showed that, if D is a cube, the rank of the Selmer group of a 3-isogeny is related to the class number of the quadratic field ℚ(√D) . Also Jan Nekevář proved some analogous result for elliptic curve given by Dy2 = 4x3 - 27 which is isomorphic to the curve given by y2 = x3 - 432 D3 . Our method is different from theirs and it can give a far more complete result for general D.