You are correct on both counts.
For members under tension, both cross-sections should behave equally, since the limit to the allowable tension force is simply:
$$P = f_y A$$
Where $f_y$ is the material's yield strength and $A$ is its area. So if both cross-sections have the same material and area, they'll resist the same load.
However, compression is different. Elements under compression can fail either by being crushed or by buckling.
The force needed to crush an element has the same equation as tension:
$$P = f_y A$$
($f_y$ may or may not be the same in compression and tension, it depends on the material). So as far as crushing is concerned, your two cross-sections will also behave identically.
The force needed for an element to buckle, however, is harder to calculate. Buckling is a behavior which "slender" members face, wherein they might suddenly get out of shape (i.e. collapse) at much lower loads than the crushing force (think of squeezing a plastic straw from both ends; you apply just a bit of force and it suddenly bends at the middle).
The theoretical buckling force is known as Euler's critical load, and is given by
$$P = \dfrac{\pi^2 EI}{(KL)^2}$$
where $E$ is the material's modulus of elasticity (basically how "unsquishy" it is), $I$ is the cross-section's moment of inertia, $L$ is the member's length, and $K$ is a coefficient having to do with how the member is supported.
If you look at those variables, the only thing that could change between the two cross-sections is the moment of inertia $I$. The moment of inertia is basically a measure of how good a cross-section is at resisting bending.
Now, I could show you how to calculate the moments of inertia for these different cross-sections, but if we just want to know which one will have a higher moment of inertia, we just need to use our intuition.
Think of a rectangular popsicle stick. Think of how easily it bends if you push it when it is horizontal, and how it basically doesn't budge if you push it when it's vertical. From this example, we can already see that the moment of inertia is very dependent on a cross-section's height and not so much on its width.
The reason why is a bit complicated to explain right now, but this means that when it comes to bending (and therefore buckling), you want to put as much of your cross-section as far away (height-wise) from its center as possible.
So, if we think of things this way, it becomes clear that the hollow section is better than the full one. After all, a hollow section doesn't "waste" material by putting it near the center and instead throws everything to the edges (specifically, it will be taller than the full section).
You could therefore imagine spreading that area into a super-thin-walled, super-tall cross-section, but don't take things too far. If the walls get too thin and the section too tall, you can start having local buckling effects which are way too complicated to discuss here. Just keep things reasonable and the hollow section will take you a long way.