Home > Web Front-end > JS Tutorial > body text

what is the difference between java and javascript

青灯夜游
Release: 2021-04-16 14:11:18
Original
70422 people have browsed it

The differences between JavaScript and java are: 1. Java is a strongly typed language, while JavaScript is a weakly typed language; 2. Different data types; 3. Different execution environments; 4. Different positioning; 5. Binding methods Different; 6. Different concurrency methods.

what is the difference between java and javascript

The operating environment of this article: Windows7 system, Dell G3 computer, Java8.0&&javascript1.8.5.

What is the difference between java and javascript? This article will introduce to you the difference between java and javascript, so that you can understand what java and javascript are? What are the differences between them. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

First we understandWhat are JavaScript and java?

JavaScript is a lightweight programming language ("scripting language") used to make web pages interactive. It can insert dynamic text into HTML. JavaScript is also known as the browser language.

Java is an object-oriented programming language with a virtual machine platform that allows you to create compiled programs that run on almost every platform. Java promises, "Write once, run anywhere."

JavaScript (JS) is not similar or related to Java. Both languages ​​have a C-like syntax and are widely used in client-side web applications, but have few similarities. Let’s take a look at the differences between them:

What is the difference between JavaScript and java?

1. Strongly typed language and weakly typed language

Java is a strongly typed language, and variables must first be declared in the program before using them; In Java, the type of variables is checked at compile time. However, JavaScript is a weakly typed language with more relaxed syntax and rules.

2. Different data types

There are 8 data types in Java, namely: byte type, short type, int type, long type, float type, double type, char type and Boolean type. However, JavaScript has only three data types, namely: number type, string type and Boolean type.

3. Different execution environments

Java applications can run in any virtual machine (JVM) or web browser, and will use more memory during execution.

However, JavaScript code only runs on the browser because JavaScript was developed only for the browser. It requires very little memory to run, so it can be used in web pages.

4. Different positioning

Java is a completely object-oriented OOP programming language. If we want to use Java to write things, we must first design the objects; and, JavaScript is different. It is an object-based OOP scripting language. It provides developers with many internal objects, making it easier and more time-saving.

5. Different binding methods

Java uses static binding and is a statically typed language. Java object references must be made at compile time, and the compiler needs to implement strong type checking.

But JavaScript is different. It uses dynamic binding and is a dynamically typed language. Its object references can be checked at runtime.

6. Different concurrency methods

Java has a thread-based concurrency method. However, Javascript has an event-based concurrency approach.

Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.

The above is the detailed content of what is the difference between java and javascript. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!