What is the relationship between Javascript and Java?
Javascript has nothing to do with Java. JavaScript and Java are different products developed by different companies; JavaScript is a scripting language that runs in the browser, and Java is executed through interpretation. The language and syntax rules are similar to C.
The operating environment of this article: windows7 system, javascript version 1.8.5, Dell G3 computer.
What is the relationship between Javascript and Jave?
Javascript has nothing to do with Java.
1. What is Javascript?
It is a scripting language that runs in the browser. In web pages, Javascript can be said to be omnipotent:
1. Can operate HTML, providing a tool to change HTML at runtime;
2. Can attach and execute events, in line with the idea of event-oriented programming;
3 . Data verification function, verify the legality of the form data when submitting the form;
4. Operations on the customer's browser, such as forward, backward, refresh, jump, open a new window, print, etc.;
5. You can create and use Cookies.
2. What is Java?
Java is a programming language launched by Sun. It is an interpreted language with syntax rules similar to C. At the same time, Java is also a cross-platform programming language. A program written in Java language is called an "Applet" (small application). After using a compiler to compile it into a class file, it is stored in the WWW page and marked accordingly on the HTML file. The client only needs to install Java The client software can run the "Applet" directly on the Internet.
Java is very suitable for corporate networks and Internet environments, and has now become one of the most popular and influential programming languages on the Internet. Java has many commendable advantages, such as simplicity, object-oriented, distributed, interpretable, reliable, safe, structural neutrality, portability, high performance, multi-threading, dynamics, etc. Java eliminates various features in C that do more harm than good and many rarely used features. Java can run on any microprocessor, and programs developed in Java can be transmitted over the network and run on any client computer.
3. The origin of the name of Javascript
JavaScript was first called Mocha, which is the code name of this project. This name was used until the release of Netscape 2.0 beta 2 (95.11.04) - including the error box that popped up in beta 1, where the name Mocha can also be seen. However, as early as September 18th, netscape had announced that it would enable a server-side script (no name mentioned) in LiveWire. And because of the "front-end and back-end universal script" design we mentioned earlier, the language used the internal name LiveScript when beta 2 was released.
But what is equally confusing is that Netscape has actually decided to name the language "JavaScript" at this time. Therefore, the language is called JavaScript in the beta 2 release memo, but the interface has been changed from Mocha to LiveScript. This situation lasted until December 4, when netscape and sun jointly issued a statement officially launching the name JavaScript. Then beta 4 was released (95.12.20), and the interface and documentation were unified.
So in fact, the life cycle of the name "LiveScript" that can be verified is only one month (95.11.04-12.04). But after all, Mocha is just the project code name, not the product name, so later when people traced the history of JavaScript, most of them only mentioned LiveScript.
4. The difference between Java and Javascript
1. JavaScript and Java are different products developed by different companies. JavaScript is a product of Netscape. Its purpose is to expand the functions of Netscape Navigator and develop an object-based and event-driven interpreted language that can be embedded in Web pages; and Java is a new generation of object-oriented language launched by SUN Microsystems. Programming language, particularly suitable for Internet application development. In fact, the original name of javascript was not javascript, but LiveScript. The "Java" in the name was authorized by SUN Microsystems.
2. JavaScript is object-based. It is a scripting language and an object- and event-driven programming language. Therefore, it itself provides a very rich set of internal objects for designers to use. Java is object-oriented, that is, Java is a true object-oriented language. Even when developing simple programs, objects must be designed.
3. The embedding methods of javascript and Java are different. In the HTML document, the two programming languages are identified differently. JavaScript uses Applet to identify it, while Java uses Applet to identify it.
4. JavaScript and Java are executed differently in browsers. JavaScript is an interpreted programming language. Its source code does not need to be compiled before being sent to the client for execution. Instead, the character code in text format is sent to the client. That is, the JavaScript statement itself is downloaded along with the Web page and is processed by the browser. Explanation and execution. The Java source code must be compiled before being passed to the client for execution. Therefore, the client must have an emulator or interpreter on the corresponding platform. It can be compiled independently of a specific platform through a compiler or interpreter. code.
5. JavaScript and Java code formats are different. JavaScript code is an address format that can be directly embedded in HTML documents and can be loaded dynamically. Writing HTML documents is as convenient as editing text files. The format of its independent file is X.js. Java is a format that has nothing to do with HTML. It must be loaded like foreign media is quoted in HTML. Its code is saved in an independent document in the form of byte code. The format of its independent file is X.class.
6. The variables used by javascript and Java are different. The variable declaration in JavaScript adopts weak type, that is, the variable does not need to be declared before use, but the interpreter checks its data type at runtime. Java uses strong type variable checking, that is, all variables must be declared before compilation.
7. JavaScript uses dynamic binding, that is, JavaScript object references are checked at runtime. Java uses static binding, that is, Java object references must be made at compile time so that the compiler can implement strong type checking.
8. JavaScript does not directly operate text and graphics. It works together with HTML element combinations in Web pages, but it can control the browser and allow the browser to directly process text and graphics. Java can directly operate on text and graphics.
Recommended study: "js Basic Tutorial"
The above is the detailed content of What is the relationship between Javascript and Java?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to use WebSocket and JavaScript to implement an online speech recognition system Introduction: With the continuous development of technology, speech recognition technology has become an important part of the field of artificial intelligence. The online speech recognition system based on WebSocket and JavaScript has the characteristics of low latency, real-time and cross-platform, and has become a widely used solution. This article will introduce how to use WebSocket and JavaScript to implement an online speech recognition system.

WebSocket and JavaScript: Key technologies for realizing real-time monitoring systems Introduction: With the rapid development of Internet technology, real-time monitoring systems have been widely used in various fields. One of the key technologies to achieve real-time monitoring is the combination of WebSocket and JavaScript. This article will introduce the application of WebSocket and JavaScript in real-time monitoring systems, give code examples, and explain their implementation principles in detail. 1. WebSocket technology

Introduction to how to use JavaScript and WebSocket to implement a real-time online ordering system: With the popularity of the Internet and the advancement of technology, more and more restaurants have begun to provide online ordering services. In order to implement a real-time online ordering system, we can use JavaScript and WebSocket technology. WebSocket is a full-duplex communication protocol based on the TCP protocol, which can realize real-time two-way communication between the client and the server. In the real-time online ordering system, when the user selects dishes and places an order

How to use WebSocket and JavaScript to implement an online reservation system. In today's digital era, more and more businesses and services need to provide online reservation functions. It is crucial to implement an efficient and real-time online reservation system. This article will introduce how to use WebSocket and JavaScript to implement an online reservation system, and provide specific code examples. 1. What is WebSocket? WebSocket is a full-duplex method on a single TCP connection.

JavaScript and WebSocket: Building an efficient real-time weather forecast system Introduction: Today, the accuracy of weather forecasts is of great significance to daily life and decision-making. As technology develops, we can provide more accurate and reliable weather forecasts by obtaining weather data in real time. In this article, we will learn how to use JavaScript and WebSocket technology to build an efficient real-time weather forecast system. This article will demonstrate the implementation process through specific code examples. We

JavaScript tutorial: How to get HTTP status code, specific code examples are required. Preface: In web development, data interaction with the server is often involved. When communicating with the server, we often need to obtain the returned HTTP status code to determine whether the operation is successful, and perform corresponding processing based on different status codes. This article will teach you how to use JavaScript to obtain HTTP status codes and provide some practical code examples. Using XMLHttpRequest

Usage: In JavaScript, the insertBefore() method is used to insert a new node in the DOM tree. This method requires two parameters: the new node to be inserted and the reference node (that is, the node where the new node will be inserted).

JavaScript is a programming language widely used in web development, while WebSocket is a network protocol used for real-time communication. Combining the powerful functions of the two, we can create an efficient real-time image processing system. This article will introduce how to implement this system using JavaScript and WebSocket, and provide specific code examples. First, we need to clarify the requirements and goals of the real-time image processing system. Suppose we have a camera device that can collect real-time image data
