A fruit is the matured ovary of a flower, containing the seed. After fertilization takes place and the embryo (plantlet) has begun to develop, the surrounding ovule becomes the fruit. The four types of fruit--simple, aggregate, multiple and accessory--which explain things like berries and pineapples.
A vegetable is considered to be edible roots, tubers, stems, leaves, fruits, seeds, flower clusters, and other softer plant parts. In common usage, however, there is no exact distinction between a vegetable and a fruit. The usual example is the tomato, which is a fruit, but is eaten as a vegetable, as are cucumbers, peppers, melons, and squashes. The classification of plants as vegetables is largely determined by custom, culture, and usage.
Nuts are considered an oily fruit and grain is also considered a fruit because of the seedlike fruits like buckwheat.