Short answer: Both.
Long answer:
Anyone should be reading on theory and analysing other people's code whether that's some of the classmates or some random people that seem to be at their level or lower and more importantly the code of experienced and knowledgeable coders. You should also code as you learn and not relying on the passive learning that can get you through school and uni.
Why? Because:
- You need to know concepts such as data-structures; when to use or not to use arrays, hashmaps, ..., algorithms and design patterns as well as understanding the paradigm used/available for a language you're learning.
- Reading other people's code will help you see solutions from different perspectives and see how someone went about solving a problem and trying to understand what they did better or/and worse than you. It will also expose you to APIs, techniques, code styles, tools etc that you may not have encountered yet.
- You should always be learning (especially in an always-evolving industry like ours).
- Passive learning is not as helpful as hands-on (active) learning where you get to put your knowledge into use and practise it.