First off, there are a lot of jobs for Java developers, so that is one reason, but why do people still use Java, including for new projects?

More recently popular high-level languages like python or ruby can be better for developer productivity, flexibility, and fast iteration due to less code cruft and verbosity. But the dynamic nature of these languages is fantastic for many broad applications, starts to break down when a project becomes very large, lots of developers are involved, or when speed and fault-tolerance are critical.

There are techniques and conventions to work around the code stability problems of dynamic typing, but techniques and conventions mean people need to follow them, and even then, there are vulnerabilities that are difficult to prevent. Take for example PHP, which is used throughout Facebook for back-end coding, was extended by Facebook to give it static typing and dynamic compilation so that it could deliver the speed and stability you would get when using technologies like Java. Exotic languages, like Scala, Haskel, Erlang, and Golang, will mainly be for specific applications best suited to them.

Java on the other hand is still best-in-class for many applications. It is the best way to build a rock-solid, fast, scalable, bug-free back-end system. It’s got the fastest JVM. Only C or C++ is faster, and only in certain narrow circumstances like compute algorithm optimization. Java is also the language of Android, the most broadly deployed smartphone OS on the planet.

Some have pointed out in the comments that Rust is an up-and-coming language, and Go is getting a strong foothold as a scalable back-end server language. Java is probably not the “best” these days in terms of abstraction and execution speed, but it still has a tremendously large installed base of libraries that these newer languages don’t have yet and might not for a long time to come.

原文