Home > Web Front-end > Front-end Q&A > What is the difference between javascript and java

What is the difference between javascript and java

青灯夜游
Release: 2023-01-04 09:34:49
Original
12289 people have browsed it

Difference: 1. Java needs to run on the JVM of JDK or JRE; JavaScript runs on the web browser, so no specific platform is required. 2. JavaScript is a dynamically typed language, and Java is a statically typed language. 3. JavaScript is weakly typed, and Java is strongly typed.

What is the difference between javascript and java

The operating environment of this tutorial: windows7 system, javascript1.8.5&&java8 version, Dell G3 computer.

The connection between JavaScript and Java:

While both languages ​​are different, there are some similarities on a broader level.

1. OOPS (Object-Oriented Programming) Concept

Both languages ​​follow the OOPS (Object-Oriented Programming) concept. You already know about working with objects in Java. Similarly, in JS, objects are the same as the relationships between them.

2. Front-end development

JavaScript can be added directly to HTML, and Java can also be used as Java Applet (Java applet).

The difference between JavaScript and Java:

1. Java is an object-oriented language, and JavaScript is a scripting language based on objects and event-driven languages.

2. Java needs to run on the JVM (Java Virtual Machine) of JDK or JRE; JavaScript runs on the web browser, so no specific platform is required. Java mainly runs on the server side; JavaScript mainly runs on the client browser.

3. Java source code must be compiled before execution, but JavaScript code does not need to be and can be directly interpreted and executed by the browser.

4. JavaScript is a dynamically typed language; Java is a statically typed language. Java cannot change the length of an array after it is defined, but JavaScript can.

5. JavaScript is weakly typed, that is, it does not need to be declared before use, but the browser interpreter checks the data type at runtime; Java is strongly typed, that is, all variables must be declared before compilation;

6. JavaScript’s object-oriented implementation is based on prototype (prototype-based), and Java is based on class (class-based);

7. Java’s grammar rules are stricter than JavaScript’s The more strict, the more powerful the function.

8. Java language code is a language that has nothing to do with HTML; JavaScript language code is a text character format that can be directly embedded in HTML documents and can be loaded dynamically.

For more programming related knowledge, please visit: Programming Video! !

The above is the detailed content of What is the difference between javascript and java. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template