JavaRush/Java Blog/Random EN/Java != JavaScript

Java != JavaScript

Published in the Random EN group
members
You are starting to learn programming. Your brain is boiling with the abundance of terms, unfamiliar words and connections between them. In addition, these words mainly come from English, which, most likely, is not your native language. Gradually you begin to build associative connections: object and object-oriented, function and functionality, variables and constants... This is how our brain works. To save neural effort, he comes up with these associations. It is for this reason that beginners often confuse Java and JavaScript and believe that they are close relatives. In fact, they are no more closely related than two other languages ​​with very different names. Their similar names are nothing more than a marketing gimmick.
Java != JavaScript - 1

First there was Java

The Java language, originally intended for interactive television and home devices, was first called Oak, after the oak tree that grew near the office of the main creator of the language. Later, the project was renamed Green and, finally, perhaps under the influence of repeated infusions of caffeine into the body, we received the name Java. Like a brand of coffee. Or an island. Looking at this name, it seems that it suggested itself: we are talking about developers, and they have a special relationship with coffee...
Java != JavaScript - 2
Sun Microsystems released the first version of Java in 1995. Its slogan promised us that what was once written in this language would work everywhere (“Write Once, Run Anywhere”). This means that the same code can be compiled for different platforms. This, coupled with the familiar C-shape syntax and the ability to run in browsers, meant that Java's popularity grew extremely quickly.

JavaScript: 10 days have passed

In the same year that the world saw Java 1.0, a Netscape employee named Brendan Eich wrote something special. Brendan was tasked by his employer with creating a language that ran natively in the browser (unlike Java, which required encapsulated Java programs to load) and was simple enough to attract non-professional programmers. As Java gained popularity, Eich managers wanted their brainchild to "look like Java." Eich complied to some extent, but did not move away from the main goal. He was writing a client-side scripting language aimed at non-professional developers, which is nothing like Java.
Java != JavaScript - 3
However, the Netscape team needed to advertise their new language. This is probably why the JavaScript project was originally named “Mocha” (that’s also coffee, yes). The name was later changed to "LiveScript" and finally to "JavaScript". It was a marketing ploy. The Netscape team wanted to ride on the glory of Java.

They are different in very important ways.

Java != JavaScript - 4
Of course, both Java and JavaScript are programming languages. You can use both to create applications, but the same can be said for any two languages. The important difference is that Java is a general-purpose programming language that is compiled, concurrent, strongly typed, class-based, and object-oriented. JavaScript, on the other hand, is primarily a web language that is interpreted, single-threaded, weakly typed, prototype-based, and multi-paradigm.

Takeaway

It would be wrong to say that Java and JavaScript are completely different from each other and have no similarities. Both of these languages ​​have a C-like syntax. Brendan Eich deliberately brought some features of Java into JavaScript. However, the main purposes of the languages ​​are so different that the similarities end there.
Java JavaScript
Designed by 1995, James Gosling, Sun Microsystems. -1995 (later), Brendan Eiche, Netscape Communications.
Language type An object-oriented language in which absolutely everything is created in classes. Object-oriented scripting language (prototype-oriented: inheritance is implemented through cloning of already existing objects - prototypes).
Typing Static (type checking is done at compile time) and strong (variables are bound to specific data types, and if the expected and actual types do not match, an error will be thrown at any stage of checking. Dynamic (type checking is carried out during execution) and weak (the type can change during program execution).
Modification After compiling a Java application, it cannot be changed on the fly; you need to edit the original code. -JavaScript code can be modified without compilation or interpretation.
Runtime Java is used to create applications that run in virtual machines or browsers. JavaScript code only runs in the browser (node.js is a whole other story).
Comments
  • Popular
  • New
  • Old
You must be signed in to leave a comment
This page doesn't have any comments yet