Many people assumes that JavaScript is similar to Java language as it contains the name but it is not true and today we well see how Java and JavaScript differs from each other.

Java vs. JavaScript



Java is an object oriented programming language. JavaScript is an object based programming language.
 Java creates application that can run in a virtual machine or browser.  JavaScript code run on browser only.
 Java code is compiled.   JavaScript is interpreted.
 Java code allows programmer full functionality and needs to be compiled.  JavaScript code contains limited number of commands and features.
 The first name of Java was OAK and was developed by James Gosling , Sun MicroSystems.  JavaScript was earlier known as ECMAScript and was developed by Brendan Eich ,Netscape.
 Java is high-level, static,compiled and strongly type language.  JavaScript is text based , dynamic and weakly typed language.
 In Java there is different datatypes like int, float, string, etc and you have to specify datatype with variable while declaring.  In JavaScript there is var keyword is used to define variable and according to value it takes datatype of that variable automatically.
 Java program has file extension “.Java” and after compilation it becomes “.class” file that contains bytecodes which is executed by JVM : Java Virtual Machine.  JavaScript file has file extension “.js”.
 Objects of Java are class based.  Objects of JavaScript are prototype based.
 Java has block based scope.  JavaScript has function based scope and object based context.