Despite their similar names, Java and JavaScript could not be more different.
Java
Java is a compiled, statically-typed language.
It is primarily used to write back-end (or server) applications that live in the Cloud.
Here is how you print Hello World!
in Java:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
JavaScript
JavaScript is an interpreted, dynamically-typed language.
It is primarily used to write front-end (or client) applications that live in the Web Browser.
Here is how you print Hello World!
in JavaScript:
console.log("Hello World!");
Why their names are so similar?
In the mid 90's, Netscape added a scripting language to their Navigator (one of the first Web Browsers).
They called the language "JavaScript" to associate it with then popular Java language.
It was just a "marketing ploy" to get more attention.