+91 99674 50288

Difference between Java and JavaScript


A lot of Programmers, developers and internet users may easily get confused been between Java and JavaScript. majority of people still thinks that JavaScript is part of Java platform, which is not true. In truth, JavaScript has nothing to do with Java, only common thing between them is word "Java", much like in Car and Carpet,cup and cupboard .Similarly, Java is very different than Javascript.

what is the java ?

Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented, high-level programming language.

Java is a programming language and first released by the Sun Microsystems. James Gosling is Inventor of Java. James Gosling, Mike Sheridan, Patrick Naughton developed the Java language project in June 1991. It was called Oak and developed as a part of the Green project. In 1995, Oak was renamed as "Java" because it was already a trademark by the Oak Technologies

what is javascript?

JavaScript is scripting or dynamic computer programming language. It is a lightweight and most commonly used for creating a web pages, whose implementations allow the client-side script to interact with the user and it make dynamic pages.

JavaScript was created by Brendan Eich in 1995 during the early days of the internet. It was officially called LiveScript which it was first shipped with Netscape Navigator 2.0 in September 1995, it was renamed to JavaScript in December 1995. It was a marketing ploy by Netscape to give it a name similar to the most popular language and at that time Java is most popular language.


what is difference between java and javascript ?

1) Execution Environment

First difference between Java and JavaScript is that Java is compiled and interpreted programming language, Java code is fist compiled into class files containing byte code and than executed by JVM and on the other hand JavaScript code is directly executed by browser.

2) Static vs Dynamic Typed language

Another key difference between JavaScript and Java is that, JavaScript is a dynamic typed language, while Java is a statically typed programming language.

3) Support of Closures

JavaScript supports closures, in the form of anonymous function. In other words, you can pass a function as an argument to another function, on the other hand Java doesn't treat method as first class citizen and only way to simulate closure is by using anonymous class.

4) OOP

Java is an Object Oriented Programming language, and though JavaScript also supports class and object like but it's more like an object oriented scripting language.

5) Right Once Run Anywhere

Java uses byte code to achieve platform independence while JavaScript directly runs on browser, but code written in JavaScript is subject to browser compatibility issue i.e. certain code which work in Mozilla Firefox, may not work in Internet Explorer 7 or 8.