When in Japan whether you're a tourist, a student or a long term resident, you should be aware that you will stand out like a sore thumb if you act inappropriately while riding the many trains that zip in and out of Japan's busy cities. I'm not talking about getting naked or attacking people! Some of the stuff in this post you won't find in travel guides for Japan or the cultural sections of Japanese textbooks so read carefully and take note!
It is extremely rude to be loud on the train in Japan and you will often see/hear elderly members of the public (especially old men or ossan) accosting youngsters who overstep the mark by having a loud conversation. In my experience you can usually tell how many foreigners are on a train by how loud it is. But do bear in mind that if you take the last train (shuuden) these social rules only partially apply since a number of people will be drunk.
Don't take this to mean that you have to keep your mouth shut every time you board a train but please keep in mind that it is the norm to not be overly loud.
Using mobile phones on the train
Generally using your mobile on the train is not the end of the world but this is really an extension of the previous point about being loud. You can text or make/receive phone calls using a quiet tone but the general rule is: don't piss people off by using your phone!
NOTE: If you get on the train at the very front, you will see a million little signs which (even if you can't read or speak Japanese) clearly convey the message "TURN OFF YOUR DAMN PHONE". This carriage is the one connected to the driver's compartment for a reason: if you even so much as have your mobile phone in your hand, the driver will come out and politely ask you 'please turn off your phone or go to one of the other carriages'.
Even though this point is CLEARLY marked all around the carriage (with even the hand rings wrapped in pictures of mobile phones inside a red ring with a line through it), you'll be surprised just how many times the driver will come out to put people in their place (and it's mostly Japanese people!). In any case, do yourself and the driver a favour and leave your phone in your bag/pocket on silent.
MEN: Don't enter the women only carriages!
I'll go into this in another post, but the abridged version of this is that Japan seems to have a big problem with men sexually assaulting women on public transport which is called chikan in Japanese. Almost all of my female Japanese friends told me that they have either been groped on the train or have a friend who has experienced it so we can safely say it is a pretty widespread problem.
As a result of this, the majority of Japanese trains (at least in metropolitan areas) have women-only carriages. Some are only in effect during peak times (because these dirty perverts strike most often when the train is packed to the limit) but others are permanently designated as women-only. If in doubt, just have a look inside and you will see whether any other men have gone inside.
If you're a foreigner, you can usually get away with this partly by playing the 'I didn't know' card but also because Japanese women know that it is very unlikely that they will be attacked by a foreigner in that way. Even so, just don't do it because you are cementing the concept of 'oh stupid foreigners don't know anything' which is unconsciously popular among some Japanese.
So there you have it
Basically don't be an idiot and you'll be fine!