Welcome to the site.
Once you have charged the capacitor to 24V, it is able to output 24V for a very brief period of time. There is a phenomenon called 'discharging of capacitor'. The voltage across the capacitor decreases exponentially. Have a look at the figure.
There is a mathematical relation relating the voltage across the capacitor and time. Go through the 'capacitor' topic. You will be able to learn how it works.
If you wanna see what I mean, simply construct a circuit and see the effect of capacitor.
simulate this circuit – Schematic created using CircuitLab
The thing you always need to keep in mind is that the voltage rating in the capacitor is the maximum voltage it can maintain across its terminals. If you have a 24V capacitor, it can be used in the above schematic. But if you have capacitor with rating less than 5V, the capacitor is gonna blow out.
For constant current discharge, I recommend you to go through this explanation in this site.