If x is the number of students in class A, mean of the two classes is (x+25)/2=7.25.
x+25=14.5 so x would be -10.5 which is meaningless. There must be an error in the question because x>0. Furthermore, x must be a natural number (integer greater than zero).
Let's see what x could sensibly be: (x+25)/2=m where m is the mean or average.
x+25=2m, x=2m-25, so, 2m-25>0, m>12.5. For example, if m=17.5, then x=10. m could not be 17.25 because x would be 34.5-25=9.5, which is not a natural number.
Mean score of 6 and 8 is (6+8)/2=7.