Does macOS Mojave comes with java pre-installed? I just ran which java command and got the output /usr/bin/java

I also executed java -version command and also got version information output. So I believe that there is an actual java executable and not just a placeholder kind of thing. I may have installed it at some point, but I cannot remember doing that. Or does it comes pre-installed with the macOS Mojave?

If it doesn't come pre-installed, how do I get rid of it?

Edit:
Below is the output of ls -l /usr/bin/java

lrwxr-xr-x  1 root  wheel  74 Sep 25 01:45 /usr/bin/java -&gt; /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
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.