4. (10 points) Two classes are planting trees. Class one plants 3 trees per person, and class two plants 5 trees per person, together planting a total of 115 trees. The maximum sum of the number of people in the two classes is $\qquad$ .
【Analysis】Let class one have $a$ people, and class two have $b$ people, then we have $3 a+5 b=115$. To maximize the total number of people in both classes, the equation can be transformed into: $3(a+b)+2 b=115$, where $a+b$ is maximized, and $b$ should be as small as possible. When $b=2$, $a+b=37$.

【Solution】Solution: Let class one have $a$ people, and class two have $b$ people, then
$$
3 a+5 b=115,
$$
$3(a+b)+2 b=115$,
to maximize $a+b$,
$b$ should be as small as possible. When $b=1$, $a$ is not an integer,
$$
\begin{array}{l}
b=2 \text {, } \\
3(a+2)+2 \times 2=115 \\
3 a+6+4=115 \\
3 a=105 \\
a=35 \\
a+b=35+2=37 \text { (people) }
\end{array}
$$

Answer: The maximum total number of people in both classes is 37.
Therefore, the answer is: 37.