Is corn a fruit, a vegetable, or a grain?

Another classic debate for the ages, answered as thoroughly as possible.