Yes, you can compost all the various bits of sweet corn on the cob – the kernels, the husk (leaves) and the central cob itself.
The kernels will rot down quickly but the husk will take a bit longer (because it’s naturally so dry) and the cob even longer still. Speed up the process by making sure the leaves are good and wet, and by chopping up the cob into smaller pieces.
Also see: How can I reuse or recycle sweet corn cobs? Ideas include using them to make hanging bird feeders or as fire lighters/kindling.