Both languages use C-style syntax, but they differ in some ways. Java is a programming language that uses Object-Oriented Programming (OOP), whereas JavaScript is an OOP scripting language.
Java develops applications that run in a virtual machine or browser, whereas JavaScript code runs only in a browser. Java code must be compiled, whereas JavaScript code is all in text.