It's considered rude while eating in Japan to walk while eating, stick the chopsticks upright in rice, make loud chewing noises or burping when eating and it's also rude to pass food from chopstick to chopstick in Japan while eating.
Other rude behaviors while eating in Japan are resting your chopsticks on the bowl, stabbing your food with chopsticks as well as blowing your nose at the table.
When in Japan do not stick your chopsticks upright in your rice as it's a funeral custom and do not pass your food directly from one pair of chopsticks to another, which is also associated with funerals.
While you can drink coffee or other beverages on the street in Japan it's also considered rude to walk and drink coffee or other beverages in Japan.
It's not illegal to drink coffee or other beverages while walking in Japan, but it's simply seen as rude so it's best to avoid it.
The custom in Japan when drinking coffee and other beverages, is to finish the coffee or other drinks when standing near where you purchased the coffee or other beverage.
Then you can dispose of the empty cup or trash where you're located.
The main reason for not drinking your coffee or other beverage while walking in Japan is because of a lack of public trash cans, which means that you would have to carry your trash with you.
Although I've seen some people dispose of their cups and cans and other trash around trees etc, when I visited Japan but it's not what you should do.
Drink your coffee or beverage near the vending machine or convenience store where you bought it and then dispose of the trash properly and use the bins that are provided at the store or the vending machine to dispose of the trash.