How do we know a corn is ripe?
If the silk is dark brown and dry and a milky juice comes out of the kernels, it is ripe. Unfortunately, that does not mean it is sweet and tasty. That has to do with when it was picked, since corn kernels convert to starch rather quickly. Supersweet varieties are bred to stay sweeter longer, but it's impossible to know what variety might be in a supermarket bin. Even at a farmstand, it's always wise to ask if the corn was picked the same day.
As well, the ear should feel heavy for its size. If it doesn't, the kernels inside may well be undeveloped.