"This isn’t the case in a language like Java, where access to the outside world is mixed in with other functionality."
That's why there is a SecurityManager: https://docs.oracle.com/javase/tutorial/essential/environmen... that - if anything - is extremely granular.