What are the differences between Java and JavaScript.png

What are the differences between Java and JavaScript?

Published on 23 May 2016

Reading time 2 minutes

One of our JavaScript trainers, Jérôme, explains the differences between Java and JavaScript to avoid any confusion.

 

Java and JavaScript are two programming languages.

One thing they have in common is that they both are C programming languages, this means that they are structured in the same way. However, they are very different in terms of use and operating.

JavaScript is an interpreted language, in other words it is being read and translated line by line at the same time as the program is being executed. JavaScript runs essentially through your web browser

On the other hand, Java is a compiled language: it goes through a JVM (Java Virtual Machine) in order to be interpreted and translated into “machine” language.

 

What also sets them apart is the fact that JavaScript is a weakly-typed scripting language whereas Java is a strongly-typed language. What variable typing means is to specify the data type to be stored (character, numeric, boolean* etc…).

 

In addition to these significant differences, these two languages are not used for the same purposes :

JavaScript is a web language, recommended for apps and websites, it is a more “creative” language, thus designed for Front end development. It is currently going through expansion, it is therefore advised to take an interest in it. JavaScript is considered to be a small scripting language, but there are a good amount of frameworks and libraries which make it seem complex at first sight. The arrival of NodeJS has made it possible for developers to use JavaScript on Back end.

Java is a back end language, meant for standalone applications (desktop and Android). It is considered to be the native language of Android applications and has a much wider range of options and functions to choose from than other languages, when it comes to this type of deployment. It is recommended for developing robust apps. However, the drawback is that it consumes a lot in terms of resources. As opposed to JavaScript, very few libraries revolve around it, this is a language that is said to be “verbose”, therefore it can appear to be a little easier to get around at first glance.

 

So why do we use the term “java” in JavaScript if these two languages don’t have much in common aside from the fact that they both belong to C programming languages?

Initially, JavaScript was called LiveScript. Its name was changed to JavaScript, in an attempt perhaps, to benefit from the reputation of Java language.

 

We hope that this article has managed to shed light on this obscure relationship between Java Vs JavaScript. Feel free to ask any questions you may have on the subjet, Florian would be more than happy to answer them!

 

*data that indicates one of two possible values, true or false