What are the differences between Java and JavaScript?

Enter a reason for deleting this comment

What are the differences between Java and JavaScript?

As the names are very similar it is easy to think that they are the same. Yet, they are not the same! So it may be interesting to point out this common misconception - JavaScript is often mixed up with Java.

But JavaScript is a scripting language. The JavaScript code is generally run on a browser and it is entirely in text. It basically resides in HTML documents, within web pages, and even in some video games. It either provides additional features in a webpage or it may also be used to create an application within the web page itself. It is thus included in all the latest browsers.

On the other hand Java is an OOP language which is used to create applications which can then be run on a browser or on virtual machines. Java is probably the most widely used and influential programming language around. Java is for applications that are run from a computer desktop or which are being initiated through a webpage.

They also need different plug-ins.

I am not an expert at this so if you could elaborate more on these differences between Java and JavaScript it would be appreciated.


Please login or sign up to leave a comment


Java and JavaScript are programming languages accustomed develop applications or options on a web page. The 2 languages have some surface similarities. They are each procedural object-oriented languages, so they look a lot of like one another (and like C++ and C#) than they appear like, say, Prolog, Lisp, or Haskell.
JavaScript was originally referred to as Livescript, and was renamed once Java was introduced as a sort of cross-marketing.
while the programming code itself has some similarities, there are variations between them.

Some different between Java and JavaScript are below:

1. initial distinction between Java and JavaScript is that Execution environment

2. Block vs perform based} Scoping Java principally uses block based scoping i.e. a variable goes out of scope as soon as control comes out of the block
and JavaScript mainly uses function primarily based scoping

3. Another key distinction between JavaScript and Java is that, JavaScript may be a dynamic typewritten language, whereas Java may be a statically typed language.Static vs Dynamic typed language

4. Java is associate Object oriented programing language, and although JavaScript additionally supports category and object, it's a lot of like associate object oriented scripting language

5. JavaScript supports closures, in variety of anonymous perform

6. Right Once Run anyplace Java uses computer memory unit code to attain platform independence, JavaScript directly runs on browser, however code written in JavaScript is subject to browser compatibility issue

7. Constructors: Java has thought of constructors, which has some special properties

8. Null Pointer Exception: JavaScript is way a lot of forgiving than Java, you do not have NullPointerException in JavaScript

9. Applicability: finally JavaScript has it's own area, sitting cozy beside html and CSS in internet development, whereas Java is all over

Thanks by ajlancer

Are you sure you want to delete this post?


I think few points to note that both JavaScript and java have OOP. And they have their own ways to handle thee OOP concepts. So making class in JavaScript is lot different than in java. Also JavaScript being browser level scripting language. A lot of desktop level improvements are yet to come to. I think desktop based programming languages can be harder to deal with these days.

Are you sure you want to delete this post?


Based on your explanation, the javascript is just like HTML and it works only when included in the HTML codes while the java is a programming language for the website. Pardon my ignorance because I have no background in java and javascript although sometimes I encounter the javascript when something goes wrong with the browser or I may have pressed an F key.

Are you sure you want to delete this post?