Home  >  Article  >  Web Front-end  >  What are java and javascript

What are java and javascript

青灯夜游
青灯夜游Original
2022-02-09 16:27:239270browse

Java is an object-oriented programming language with cross-platform, object-oriented, and generic programming features. It is widely used in enterprise-level web application development and mobile application development. JavaScript is a cross-platform interpreted, dynamically typed, weakly typed, network-based scripting language that is used to add some dynamic effects and interactive functions to web pages.

What are java and javascript

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

What is java

Java is an object-oriented programming language that not only absorbs the various advantages of the C language, but also abandons the C language. There are concepts such as multiple inheritance and pointers that are difficult to understand in Java. Therefore, the Java language has two characteristics: powerful functions and simple and easy to use. As a representative of static object-oriented programming languages, Java language perfectly implements object-oriented theory and allows programmers to perform complex programming with an elegant way of thinking.

Java has the characteristics of simplicity, object-oriented, distributed, robustness, security, platform independence and portability, multi-threading, and dynamics. Java can write desktop applications, Web applications, distributed systems and embedded system applications, etc.

Characteristics of Java language

The style of Java language is very similar to C language and C language. It is a pure object-oriented language, which inherits the object-oriented language of C language. It is the core technology of C, but abandons some shortcomings of C, such as pointers that easily cause errors and multiple inheritance. It also adds a garbage collection mechanism to release unused memory space and solve the trouble of managing memory space.

The Java language is a distributed object-oriented language with many features such as object-oriented, platform-independent, simplicity, interpretation and execution, multi-threading, security, etc. These features are introduced one by one below.

1. Object-oriented

Java is an object-oriented language. It has good understanding of classes, objects, inheritance, encapsulation, polymorphism, interfaces, packages, etc. in objects. support. For simplicity, Java only supports single inheritance between classes, but multiple inheritance can be implemented using interfaces. To develop programs using Java language, you need to adopt object-oriented thinking to design programs and write code.

2. Platform independence

The specific manifestation of platform independence is that Java is a "Write Once, Run Any Where" language, so it is written in Java language The program has good portability, and it is Java's virtual machine mechanism that ensures this. After the introduction of virtual machines, the Java language does not need to be recompiled to run on different platforms.

The Java language uses the Java virtual machine mechanism to shield relevant information about specific platforms, so that programs compiled in the Java language only need to generate target code on the virtual machine and can run on multiple platforms without modification.

3. Simplicity

The syntax of Java language is very similar to C language and C language, making it easy for many programmers to learn. For Java, it abandons many features that are difficult to understand in C, such as operator overloading and multiple inheritance. Moreover, the Java language does not use pointers and adds a garbage collection mechanism, which solves the problem that programmers need to manage memory. Makes programming easier.

4. Explanation and execution

When a Java program is run on the Java platform, it will be compiled into a bytecode file, which can then be run on an operating system with a Java environment. When running the file, the Java interpreter interprets and executes these bytecodes, and the classes that need to be added during the execution are loaded into the running environment during the connection phase.

5. Multi-threading

The Java language is multi-threaded, which is also a major feature of the Java language. It must be created by the Thread class and its subclasses. Java supports multiple threads executing simultaneously and provides a synchronization mechanism between multiple threads. Each thread has its own run() method, and the method to be executed is written in the run() method body.

6. Distributed

The Java language supports the development of Internet applications. Among the basic application programming interfaces of Java, there is a network application programming interface, which provides a class library for network application programming. Including URL, URLConnection, Socket, etc. Java's RIM mechanism is also an important means of developing distributed applications.

7. Robustness

Java’s strong typing mechanism, exception handling, garbage collection mechanism, etc. are all important guarantees for Java’s robustness. Discarding pointers is a major advancement in Java. In addition, Java's exception mechanism is also a major manifestation of robustness.

8. High performance

Java’s high performance is mainly compared to other high-level scripting languages. With the development of JIT (Just in Time), Java’s running speed is also getting faster and faster. high.

9. Security

Java is usually used in a network environment. For this reason, Java provides a security mechanism to prevent malicious code attacks. In addition to the many security features of the Java language, Java also adds a security prevention mechanism to classes downloaded through the network, allocates different name spaces to prevent local classes of the same name from being replaced, and includes a security management mechanism.

The many features of the Java language enable it to occupy a large market share among many programming languages. The Java language's support for objects and powerful API make programming work easier and faster, greatly reducing program development costs. . Java's "write once, execute anywhere" is one of its advantages that attracts many businesses and programmers.

What is javascript

JavaScript ("JS" for short) is a lightweight, interpreted or just-in-time compilation with function priority type programming language. Although it is famous as a scripting language for developing Web pages, it is also used in many non-browser environments. JavaScript is based on prototype programming, a multi-paradigm dynamic scripting language, and supports object-oriented, imperative, declarative, and functional programming paradigm.

JavaScript is a dynamically typed, weakly typed, prototype-based language. Its interpreter is called the JavaScript engine, which is part of the browser and is widely used in client-side scripting languages. It was first used on HTML web pages to add dynamic functions to HTML web pages.

JavaScript is a network scripting language that has been widely used in Web application development. It is often used to add various dynamic functions to web pages to provide users with smoother and more beautiful browsing effects. Usually JavaScript scripts realize their functions by embedding them in HTML.

JavaScript is a cross-platform interpreted language that does not require pre-compilation and can run under various operating systems.

Characteristics of JavaScript

JavaScript has the following characteristics:

1) Interpreted scripting language

JavaScript is an interpreted scripting language Unlike scripting languages ​​such as C and C, which need to be compiled first and then run, code written in JavaScript does not need to be compiled and can be run directly.

2) Object-oriented

JavaScript is an object-oriented language. Using JavaScript, you can not only create objects, but also operate and use existing objects.

3) Weak type

JavaScript is a weakly typed programming language that does not have strict requirements on the data type used. For example, you can initialize a variable to any type, or you can initialize it at any time. Change the type of this variable.

4) Dynamic

JavaScript is an event-driven scripting language that can respond to user input without the help of a Web server. For example, when we visit a web page , when you click on a web page with the mouse or scroll the window, you can directly respond to these events through JavaScript.

5) Cross-platform

JavaScript does not depend on the operating system and can run in the browser. Therefore, after a JavaScript script is written, it can be run on any system, as long as the browser on the system supports JavaScript.

What JS can do

JavaScript can be used in various fields of web development, such as:

  • Web application development: The web pages we browse in daily life are composed of HTML, CSS, and JavaScript. JavaScript can update the styles of elements in the web page in real time, and enable interaction between people and web pages (such as monitoring whether the user clicks the mouse or presses the button). (press a certain button, etc.), you can also add some cool animations to the web page;

  • Mobile application development: In addition to web application development, JavaScript can also be used to develop Applications on mobile phones or tablets, and we can also use some excellent frameworks (such as React Native) to make development easier;

  • Web games: We have played on the web Those small games can be implemented using JavaScript;

  • Back-end Web application development: In the past, we used JavaScript to develop the front-end part of the Web application, but with Node The emergence of .JS (a JavaScript runtime environment) allows JavaScript to also be used to develop the back-end part of Web applications.

[Related recommendations: javascript learning tutorial]

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

Statement:
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