Yes, and the rules are less about law than about reading the room. Eating while walking down the street is completely normal in some countries and quietly frowned upon in others, including Japan, where the custom is to stand near the stall or find a spot to finish your food. On public transport, many metro systems formally ban eating and drinking, sometimes with fines, so watch for signage and simply notice whether anyone around you is snacking.
The most important timing rule involves religious fasting periods. During Ramadan in Muslim-majority countries, eating, drinking, or smoking in public during daylight hours ranges from insensitive to actually penalised depending on the country; visitors are not expected to fast, but discretion, meaning eating indoors or in screened restaurant areas, is expected. Check the dates before travelling since they shift each year.
On sharing: cultures vary between communal dining, where dishes sit in the middle and everyone serves from them, and individual portions. In communal settings, take modestly from shared plates, use serving utensils or your right hand as locals do, and never reach across others. Offering to share your snacks with companions is a warm gesture in most collectivist cultures, where eating alone in company without offering can seem cold.