The gravitational potential energy of an object is given by
[tex]U=mgh[/tex]
where m is the mass, g the gravitational acceleration and h the height with respect to a reference point.
Here we know the potential energy of the apple, U=6.0 J, its height, h=3.00 m, and [tex]g=9.81 m/s^2[/tex], so we can find the mass of the apple by re-arranging the formula:
[tex]m= \frac{U}{gh}= \frac{6 J}{(9.81 m/s^2)(3 m)}=0.20 kg [/tex]