Is there any way to prevent falling asleep in class?

Find your interests. If you like that teacher or that course, I think you have the motivation to listen carefully. If you like novels, you can put them under your desk and look at the cover when you are tired. Other drugs are ok, I don't want to sleep so much. In fact, I think color can impact people's vision, and it doesn't matter if you doze off occasionally, but you should be moderate. I wish you an early and happy study.