There are 3 state of matter they are solid ,liquid,gas
lets take example of water .
when the solid state of water that is the ice heated it becomes water which is the liquid state when it is further heated it becomes water vapour that is the gaseous state. when the water vapour is cooled it becomes water and when it is further cooled it becomes ice. the state of matter can be changed by either heating and cooling