Japan and China reacted to European contact in ways that were mostly rather different. The two countries both thought the Europeans were culturally inferior to themselves, but the Japanese were much more willing to learn about European science and technology.
Both the Chinese and the Japanese felt that the Europeans were barbarians. They were particularly repelled by the smell of these foreigners who ate much fattier diets and who did not typically wash very often. They also felt the Europeans lacked subtlety and were rather crass in their behaviors.
The similarities, however, largely end there. The Chinese tried to simply ignore the Europeans. They were able to do this to some degree because the Europeans did not have anything they wanted. They were willing to take European silver in exchange for tea and otherwise leave the Europeans alone. This worked until around the time of the Opium Wars when the Europeans forced China to open itself more.
The Japanese, by contrast, were more eager to learn from the Europeans. It is true, of course, that the Japanese closed their country. They did not let Europeans in and they did not let Japanese out. But they did still let some European ways in to the country. They were willing to get European technologies such as guns because they felt those things could be useful to them.
This pattern continued for a long time. Even after it became clear that the Europeans could defeat the Chinese militarily, the Chinese did not try to adopt European ways to any great extent. By contrast, the Japanese industrialized and modernized rapidly after Perry “opened” Japan in the 1850s.