We can’t say how many castles including the historic ruins are there in Japan. Once, it was said that there were more than 20,000 castles in Japan. Today, it would be at least more than 100 according to the Japan Castle Foundation.
If we just pick up the castle having donjon, there are 12 castles existing from the Edo era. They include 4 national treasures; Himeji castle (the above right picture), Matsumoto Castle, Hikone Castle and Inuyama Castle. There are also about 30 castles restored or revived, which includes Osaka castle (the above center picture). Recent tourism encouragement in Japan also has promoted the restoration more and more and the limited opening of some area of the castle inside, such as the one in Odawara castle.
There are also castles just keeping buildings and ruins such as the Imperial Palace in Tokyo, Kyoto Gosho or Nijo Castle in Kyoto.
Unlike European castles which were located in the center of the castle town surrounded by the tall castle wall where commoners lived inside too, Japanese castles built from the Age of civil war around the end of 15th century through Edo era (until 1868) were functioned as fortresses to fight or to protect against the enemy. Only the Shogun, feudal loads and Samurai class were inside of the castle area. No commoners such as merchants and farmers were not inside of the area, but a castle town was certainly developed around the castle.
Most castles had big stone walls and one or more moats around them, which can be seen in the Imperial Palace (the above left picture) in Tokyo. The building materials were basically wood unlike the stone one of European castles.
It would be one of the special experiences for tourists to view and to go inside of the castle donjon or to observe the unique construction of even part of castles or ruins. Japan National Tourism Organization provides good lists to know typical castles in Japan.