Both of the equations you mentioned can be used.
Say you have a given sphere in R3, centered at the origin (0,0,0).
I am going to use spherical coordinates, as it is a lot easier to calculate the volume of a sphere with spherical coordinates.
Basically, if you integrate teh function 1 over a volume, you get the volume of the object.
EDIT: thed function you integrate over is 1 in normal coordinate system, but when yoiu go to spherical coordinates you have to multiply the function 1 by the Jacobian, rho^2 sin(phi). So the integral is tripple integral of rho^2 sin(phi), according to the following diagram and limits. you are integrating over Rho, phi, and theta:
Limits:
Rho: <0,r>
Phi: <-pi/2 , pi/2>
Theta: <0 , 2pi>
This will yield the volume using a Tripple integral.
For some reason the Latex code isn't working right now.
\int ^{0}_{r} \int ^{-\pi / 2}_{\pi / 2} \int ^{0}_{2\pi} \rho ^{2} sin(\phi ) d\phi d\theta d\rho
for some reason the latex command is showing up wrong, if someone else can post it...
\int ^{0}_{r} \int ^{-\pi / 2}_{\pi / 2} \int ^{0}_{2\pi} 1 d\phi d\theta d\rho