Today I've written Java, Python, C++, and SQL (if it counts). And I've been at work for less than 2 hours. If you do this regularly, then the mental shift becomes negligible. It has nothing to do with multitasking. It's just like walking for a while, then driving a car, then driving a bike, then swimming. No problem, because they're sequential things.