This is a observational learning, part of social learning, which consists of learning by observing the behavior of others. It is more likely that the observed behavior will be learned if it was praised or awarded by others.This is why John changed his behavior.