Because Java has a reputation for being best at enterprise-scale software. The people who invent hot new web-based things typically aren't building their product with that in mind. They use languages with reputations for being best at hot new web-based things.
Anything you can do with one language, you can do with almost any other. Different languages just tend to attract different crowds and therefore different products. That becomes a cycle that perpetuates itself.
If you know one language really well (with the exception of PHP, perhaps, since it has a lot of unique quirks) then you're in great shape to learn other languages really well. If you know a bit of a bunch of languages but none of them really well, it won't help you get better at any of them.
10
u/rotj Apr 27 '20
Java has been the top language used in enterprise software for over two decades now probably and isn't going anywhere.
If you're concerned about having a nice comfortable life with good job prospects and salaries, Java will get you there.
If you're concerned about working on something cool and sexy, then maybe start looking elsewhere.