Yes traveling is possible, but on Java it is good to consider it, while planning
During Ramadan, Muslims fast from sunrise to sunset. This means that they are not allowed to drink, eat or smoke. Most people on Java are Muslims and therefore fasting.
On Bali, most residents are Hindu. Because of this the Ramadan will not influence life on Bali.
Ramadan on Java
The Ramadan lasts approximately one month. Every year Ramadan starts on a different date, because the start is related to the position of the moon. Ramadan is the month of reflection, charity and tolerance. Fasting makes people more aware.
Some restaurants are closed during the day during Ramadan, other restaurants have covered their windows to prevent the people who fast from being confronted with people who are eating.
When you can be seen in public, also try to avoid smoking, eating and drinking yourself.
After sunset (around 18.00h) it gets lively on the streets, with many food stalls where people break the fast together.
Life is also a bit more sober. For example, there are no dance performances in the Kraton during Ramadan.
An advantage of traveling during Ramadan is that there is less local tourism and therefore tourist spots are not that busy and hotels can be cheaper.
When Ramadan is over, there will be a celebration for a number of days (Idul Fitri). Everyone will visit their family and from the big cities many people go to their native villages to be together as a family. You can compare this with celebrating Christmas in Europe.
Therefore at the end of Ramadan it is very busy on the roads. Trains and airplanes are fully booked. If you travel at the end of the Ramadan it is very important to make your reservations and bookings in time. Prices can be higher than normal. Because a lot of people take some days off, some tourist spots are closed around Idul Fitri.
The Ramadan will start and end:
in 2020 from April 24 to May 24,
in 2021 from April 13 to May 13,
in 2022 from April 3 to May 3.