js| Difference | design | Web page design
In a variety of Web page making technology forums, there are often questions about how JavaScript differs from Java, and even some people mistakenly think JavaScript is java. JavaScript and Java do have a certain connection, but they are not as tightly connected as we might think, and they can be said to be quite different.
What is JavaScript?
JavaScript is an implementation of the ECMA 262 language specification. The purpose of this tutorial is to guide you through the use of JavaScript, all of which are passed under Internet Explorer 5, and I am not tested in Netscape's browser, so there may be examples that are not running smoothly in Netscape's browser.
easy to learn and easy to use
JavaScript is an interpreted, object-based scripting language. Although JavaScript is less functional than a mature object-oriented language such as C + + and Java, JavaScript is a big enough feature for its intended use.
JavaScript is not a compact version of any other language (for example, it's just a vague and indirect relationship with Java), and it's not a simplification of everything. However, it has its limitations. For example, you cannot use the language to write applications that run independently, and there is little functionality in the language to read and write files. In addition, JavaScript scripts can be run only on an interpreter, either as a Web server or as a Web browser.
JavaScript is a relaxed type of language. This means that you do not have to explicitly define the data type of the variable. In addition, in most cases, JavaScript will automatically convert as needed. For example, if you try to add a numeric value to an item (a string) that is composed of text, the value is converted to text.
What is Java?
Java is a programming language introduced by Sun. It is a language that is executed by way of interpretation, and syntax rules are similar to C + +. At the same time, Java is a cross-platform programming language. Programs written in the Java language are called "applets" (small applications), using the compiler to compile it into a class file, it will exist in the WWW page, and the corresponding markup on the HTML file, the user side as long as the client software installed Java can directly run the "Applet" online. Java is ideal for corporate networks and the Internet environment and is now one of the most popular and influential programming languages on the Internet. Java has many commendable advantages, such as simple, object-oriented, distributed, interpretive, reliable, secure, structured
Neutrality, portability, high-performance, multithreading, dynamic and so on. Java has abandoned C + + in a variety of advantages and disadvantages of more than the benefits of the function and a lot of rarely used features. Jave can be run with any microprocessor, programs developed in Java can be transmitted over the network and run on any client.
The difference between JavaScript and Java is mainly shown in the following areas:
One, JavaScript and Java are different products developed by different companies. JavaScript, a product of Netscape, is designed to extend the capabilities of Netscape Navigator, an object-oriented and event-driven interpretive language that can be embedded in Web pages; Java is Sun Microsystems's new generation of object-oriented programming languages, especially for Internet application development. In fact, the original JavaScript name is not JavaScript, but LiveScript, the name of "Java" is authorized by Sun Microsystems Company.
Second, JavaScript is object-based, it is a scripting language, is an object-based and event-driven programming language, so it itself provides a very rich internal objects for designers to use. Java is object-oriented, Java is a real object-oriented language, even the development of simple programs must design objects.
Third, JavaScript is not the same way as Java embedding. In HTML documents, the identities of the two programming languages are different, JavaScript uses ... To identify, and Java uses to identify.
Four, JavaScript and Java in the browser to perform the same way. JavaScript is an interpretative programming language whose source code is not compiled before it is sent to the client, but rather a text-formatted character code is sent to the customer, that is, the JavaScript statement itself is downloaded with the Web page and interpreted by the browser. The Java source code must be compiled before it can be passed to the client, so that the client must have an emulator or interpreter on the platform that compiles code independently of a particular platform through a compiler or interpreter implementation.
Five, JavaScript and Java code format is not the same. JavaScript code is a kind of seek the Tsui address Mark Sword tip disaster tml documents, and can be dynamically loaded, writing HTML documents is as convenient as editing text files, the format of their stand-alone files is *.js. Java is an HTML-independent format that must be loaded by using an external media like HTML, whose code is stored in a separate document in the form of a byte code, and its standalone file is formatted as *.class.
Six, JavaScript and Java to take the variable is not the same. Variable declarations in JavaScript take a weak type, meaning that a variable is not required to be declared before it is used, but rather that the interpreter checks its data type at run time. Java uses strongly typed variables to check that all variables must be declared before they are compiled.
JavaScript uses a dynamic binder, which is a JavaScript object reference that is checked at run time. Java uses a static binder, that is, Java object references must be made at compile time to enable the compiler to implement strong type checking.
JavaScript does not manipulate text and graphics directly, it works with HTML elements in a Web page, but it controls the browser so that browsers can manipulate text and graphics directly. Java, in turn, can manipulate text and graphics directly.
To sum up, we can find that JavaScript and Java can be applied to web design, but they do have too much difference, is basically two languages.