If you travel Japan, you will notice immediately the public lavatory(toilet). You can find it almost everywhere you go. All stations except isolated ones have lavatories either inside the paid area or outside the ticket gate. Then, relatively middle size or larger parks definitely have at least one WC on the premise.
Therefore there is no need to worry finding the toilet when you are outside in Japan. However, please keep in mind that these lavatories are not staffed, which means security level is lower than those in Europe. Therefore better to avoid using isolated toilet or toilet which is out of pedestrian's sight.
Then, these lavatories can still have traditional Japanese style toilet and sometimes it is not clean as you expect as like in airport and department stores. Then, also sometimes there is no toilet papers equipped inside the cabin. In this case, you have to use your own tissues or you can buy it at the entrance. Therefore if you see a vending machine selling tissues at the entrance, it means there is no paper inside the cabin. Then, there are several public toilets which charge fees, especially located in Tokyo. These fees are usually JPY 100 per person and kept clean and safe.