This question pertains to the USA. In all public universities I'm aware of, anyone can get on campus, sit in on virtually any lecture, and enter the school's library. Does this mean that public universities are considered public space? What about within a public university classroom? Do people have an expectation of privacy when in a public university classroom?
You must be a student enrolled in the class to (legally) attend it. A class is not "open to the public," and permission from the instructor must be given to "sit in" on a class. So yes, there is an expectation of privacy in the classroom, limited to only those enrolled or teaching in the current class in the current term.