I was just checking navigator object and saw the javaEnabled()
method. so why it's there and what is use of java when javascript is only language interpreted by browser.
From the specification:
The navigator.javaEnabled() method must return true if the user agent supports a plugin that supports the MIME type "application/x-java-vm"; otherwise it must return false.
(My emphasis).
It is for determining if there is support for, for example, Java Applets (which require a plugin). In 2019 there usually isn't, but it was common two decades ago.