It is not permissible to stay in the classroom when music is being played either on a tape player etc. or by a person, even if that means that you will not understand the nature of a particular type of music such as jazz etc., because if something evil is done in a gathering, the Muslim has to denounce the one who is doing it, and if he does not respond, then he (the Muslim) should leave that place, as Allaah says (interpretation of the meaning):
“And it has already been revealed to you in the Book (this Qur’aan) that when you hear the Verses of Allaah being denied and mocked at, then sit not with them, until they engage in a talk other than that; (but if you stayed with them) certainly in that case you would be like them. Surely, Allaah will collect the hypocrites and disbelievers all together in Hell”
We advise you to choose subjects where you will not have to study this material at all, May Allaah help you and us to obey Him.