You stand up in class to try to avoid it. I have seen people fall asleep standing up though. During basic, everyone is falling asleep in briefings so half the time, you just stand through the briefing. I personally fell asleep marching to lunch one day. I still don't know how I got to Mitch's that day. After talking to many professors, they would rather just have you stand through every single one of their classes, than fall asleep on them. They don't notice people standing up, they notice people falling asleep. Coffee and energy drinks are also commonly used, although I don't personally think they are that effective. Just find something that works for you, but find it early.