You can "thump" a watermelon and detect any color changes in the outside of the fruit to see if it is ripe. A ripe watermelon should sound hollow when thumped and should have a dull sheen.
Watermelons in the garden are ripe when the green, curling tendrils attaching them to the vine turn brown and wither. Whether the watermelon is in the garden or in a grocery store, if it sounds hollow when thumped, it is in the best condition to be eaten. While not all ripe watermelon sound hollow when thumped, those that do are typically the sweetest.