Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

The difference between javascript and java


May 30, 2021 Article blog


Table of contents


Java and JavaScript what difference, it is said that there are many people do not know, to give everyone a science of the difference between the two!

 The difference between javascript and java1

Java and JavaScript are different:

1. The use is not the same:

Their most essential difference is the use: Java is now widely used on the PC side, mobile phone side, Internet, data center and so on;

JavaScript, on the other hand, is primarily used to embed text into HTML pages, read and write HTML elements, control cookies, and so on.

2. Different origins:

Javascript and Java are different products developed by different companies. Javascript is Netscape's scripting language;

Java, on the other hand, is the next generation of object-oriented programming languages introduced by SUN Microsystems.

3. Embedding is different:

In HTML documents, the two programming languages are identified differently, with Javascript using <script ></script >, and Java using Applet to identify.

4. Different language types:

JavaScript is a dynamic type language, while Java is a static type language.

5. The variables taken are different:

Variable declarations in JavaScript are weakly typed, meaning that variables do not need to be declared before they are used, but rather that the interpreter checks their data types at runtime. Java takes a strong-type variable check, which means that all variables must be declared before compiling.

6. The code format is different:

Javascript's code is dynamic, can be embedded directly into HTML documents, and can be dynamically mounted, making html documents as easy as editing text files, with separate files formatted in .js. Java is an HTML-independent format that must be mounted like foreign media referenced in HTML, its code saved in byte code in a separate document, and its stand-alone file in the form of a .class.

Javascript uses dynamic co-editing, where Javascript's object references are checked at runtime. Java uses static co-editing, where Java's object references must be made at compile time to enable the compiler to implement strong type checking.

Javascript doesn't work directly on text and graphics, it works in combination with HTML elements on Web pages, but it controls the browser and lets it work directly with text and graphics. J ava, on the other arm, can manipulate text and graphics directly. 6.

What Java and JavaScript have in common:

Their syntax and C languages are similar; they are object-oriented (although implemented in slightly different ways); JavaScript is designed with Java naming rules in place; and, in short, JavaScript is a far cry from what it looks like. JavaScript is designed with objects that do not include Java, but include languages such as Self and Scheme.

Java and JavaScript each have their own expertise, Java's stage is in the field of programming, and JavaScript's strength is that it's almost omnipotent on Web pages.