Japan is a racist society, although I think the younger folks tend to veer away from that mentality.
I believe that the "us vs. them" worldview is instilled at a very early age. Whenever I passed a group of Japanese schoolchildren (perhaps kindergarten age) in Tokyo when I visited ten years ago, they would yell out "gaijin", almost in unison, while pointing at me. At the same time, though, many of them would smile and make their best effort to say hello (which comes out as "herro"). So while they are learning about the world, and learning basic English, they are also learning about the distinction between the Japanese people and the other.