How not to sleep in class?

Make sure that you get enough sleep at night, before going to class. Pay attention to what is going on in class. Don't daydream, don't get lost in your own thoughts. Someone is trying to teach you something, see if you can learn it.