Matrix Rotation

I was wondering how can I be able to perform multiple matrix rotations and get the same effect as doing each individually?
For example

Matrix world, rot;
world = rot.rotateX(56.5) * rot.rotateY(45.5);
glMultMatrixf(world.data();

instead of doing this

Matrix rot;
rot.rotateX(56.5);
glMultMatrixf(rot.data());
rot.rotateY(45.5);
glMultMatrixf(rot.data());

Where is the problem?

And if I understand correctly what you do, you compute twice the same rotation around the X axis, then once a rotation around Y axis and finally multilply the modelview matrix by all these transformations.
Or maybe, I am wrong, and each call matrix.rotate* replace the current matrix.

Well, you just have to perform matrix multiplication! If you don’t know how, consult google…

Yeah I know how to do matrix multiplication. But if I do it that way, it rotations but bounces in and out. The only way was to break it into seperate parts