How many years do hero students study at U.A. to become professional heroes? So far from the anime I remember there is a Class A and a Class B for students, and in episode 24th from season 3, 3 students from a superior year appeared to give a talk to the students from Class A. How many years do hero students study at U.A. until they become professional heroes?
3 years

According to web-japan.org (emphasis mine):


  The basic school system in Japan is composed of elementary school (lasting six years), middle school (three years), high school (three years), and university (four years).


Considering that U.A. is a high school, we can conclude that students study for three years before graduating and becoming professional heroes.

However, it may be important to note that in Season 3, Episode 22:


   Class 1-A was able to obtain their provisional hero licences, allowing them to do limited work as pro heroes.


Knowing this, this could change the answer to:


   Under 1 year.


I'll leave it to you to decide what the answer is.