A Java application runs on a JVM by converting the source code into byte code, whereas JavaScript must be embedded in HTML documents and executed in a web browser.
1
Static typing in Java requires variable and type declarations before compilation and execution, whereas dynamic typing in JavaScript lets you define type and variable at any time.
2
Java supports concurrent events through multi-threading, which makes it more efficient and faster whereas JavaScript does not support concurrent events.
3
Unlike Java, which hides its source code behind bytecode, Javascript runs code on a browser, visible to everyone in plain text.
4