2 joined objects won't display materials correctly
I suppose the problem is the following: you have a mesh with two materials and you want to change these materials but keep respectively the faces that correspond to the first and to the second.

Say we have a mesh with two materials RedOne and BlueOne, like this:



If you remove the material slots and add new material slots, you will lose which face is correspond to which material:



Instead of removing the slots, you should assign them directly the new materials, because faces of the mesh are assigned to slots (and so you keep face/slot correspondences).