In the Mathematics class, I sit next to John, who is captain of basketball team.
We don't use article with the name of a subject so going by this correct sentence should be
In Mathematics class, I sit next to John, who is captain of basketball team.
But what if I want to refer to a specific class then how will I say that ? We use article the to refer to a specific thing but since its incorrect to use the here how do I say that without using the with mathematics?