That should work fine. SQL 2022 has a few more features that will not be available to your class-mates, but no one will notice. Everything that runs on SQL 2019 runs on SQL 2022.
And, also, you can have both installed. More precisely, you can have many instances on a single computer, and they can be running the same or different versions. But possibly you have messed up some folder prohibiting an install of SQL 2019.