Let the tree with degree max $=2$ ,
Let , no of internal nodes whose degree $>1 =k$
then no of pendent vertex $= n-k$
now as we know that no of edges in tree $= n-1$
by handshaking theorem ,
sum of degrees of each verteces $= 2 *$ edges
now , $2*(k)+1*(n-k) = 2*(n-1) \Rightarrow k = (n-2)$