P(first one was yellow) = 4/40 = 0.10.
P(second one was yellow) is different, because the bag contained only 39 beans after the first draw. This probability was 3/39 = 0.077.
The prob. that the first one was yellow and the second one also was yellow is the product of the two probabilities found above: 0.10*0.077 = 0.0077, or 0.008, or 0.01, depending upon the level of accuracy you want.