Does macOS Mojave comes with java pre-installed?
Java does not come preinstalled.

The /usr/bin/java command does come preinstalled, though - but it is not Java. Instead it is an Apple program that lets you decide between multiple installed JDKs (if any). If you haven't got a JDK installed, which is how the system is by default, it will tell you via a popup and let you click a button to be directed to a download site for the JDK.