Vegetable is a culinary term. Its definition has no scientific value, and is somewhat arbitrary and subjective. Any part of an herbaceous plant that humans eat whole or in part is a vegetable, except for culinary fruits and arguably grains, nuts, herbs, and spices. Also, mushrooms are commonly considered vegetables, despite belonging to a different biological kingdom, namely fungi (which used to be classified as plants).
Vegetables include leaf vegetables (for example lettuce), stem vegetables (asparagus), root vegetables (carrot), flower vegetables (broccoli), bulbs (garlic) and botanical fruits such as cucumbers, squashes, pumpkins, avocados, capsicums, as well as botanical pulses such as green beans, and fleshy, immature seeds such as those of peas or beans.
Since "vegetable" is not a botanical term, there is no contradiction in a plant part being a fruit botanically while still being considered a vegetable (see
diagram). See Nix v. Hedden for a United States Supreme Court's ruling on the matter.
In general, vegetables are thought of as being savoury, and not sweet (with some exceptions, such as rhubarb and pumpkin).