Investigating the Learning Behaviour of In-context Learning: A Comparison with Supervised Learning