What is the difference between javascript and java

醉折花枝作酒筹
Release: 2023-01-06 11:13:29
Original
5436 people have browsed it

Difference: 1. JavaScript is interpreted and executed by the browser, while Java programs are compiled and executed. 2. JavaScript provides a wealth of built-in objects for developers to use; Java must design objects regardless of whether the development program is simple or not. 3. JavaScript is a weakly typed language, while Java is a strongly typed language.

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

Java is an object-oriented programming language developed by Sun Corporation and is suitable for network application development. JavaScript was originally inspired by Java and was designed to "look like Java". Therefore, the syntax is similar to Java, and some names and naming conventions are also derived from Java.

But in fact, JavaScript is very different from Java in other aspects except that it is somewhat similar to Java in syntax and as mentioned above for marketing purposes. In the following points:

1) JavaScript is interpreted and executed by the browser, while Java programs are compiled and executed.

2) JavaScript is an object-based scripting language, which provides a wealth of built-in objects for developers to use directly; Java is a true object-oriented programming language, regardless of the simplicity and complexity of the developed program. No, both must design objects.

3) JavaScript is a weakly typed language. When declaring a variable, you do not need to declare the type of the variable, or even use the variable directly without declaring the variable; Java is a strongly typed language, and the variable must be declared before use and must be declared. type.

4) The code format and the way to embed HTML documents are different: Java code must be compiled into bytecode files using corresponding compilation tools, and HTML documents must be embedded using tags Bytecode file; JavaScript code is a text character format. Embedding HTML documents uses the tag, in which JavaScript code can be embedded directly or JavaScript script files can be embedded.

[Recommended learning:javascript advanced tutorial]

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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!