Shinkansen rolling stock tend to be phased out much faster
than commuter and local trains, to take advantage of the newest technologies that enable cost reductions and improved amenities. Tokaido Shinkansen, the busiest and most profitable of the network, replaces its rolling stock around the 14 year mark, since the useful life of electric rolling stock for depreciation is 13 years in Japan.
Commuter trains in urban areas tend to be used upwards of 40 years with one or two rehabilitation cycles. That said, the busiest lines generally get new shiny trains every 15-20 years with older ones being sent to less busy lines.
The recent trend (since the 90s) have been to build cheaper, lighter and less long lasting trains, so that trains around that 20-25 year mark can be replaced with ones using the latest technology. That said, I've seen those trains being fitted with the latest traction units (not cheap!) around the 15 year mark, so we'll see how long they intend to use them.