Java vs. JavaScript
Java was introduced by Sun Microsystems in 1995. The programming language designed for use in the distributed environment of the Internet (TechTarget). Although it was designed to have the "look and feel" of the C++ language, it offers greater ease of use and enforces an object-oriented programming model. Programmers can use Java to create complete applications that may run on a single computer or be distributed among servers and clients in a network. Programmers can also use Java to build a small application module or applet for use as part of a Web page. Applets make it possible for a Web page user to interact with the page.
JavaScript is an interpreted programming or script language created by Netscape to integrate the functionality of Java with HTML (TechTarget). It is similar in capability to Microsoft's Visual Basic, Sun's Tcl, the UNIX-derived Perl, and IBM's Rexx. Script languages are easier and faster to code in than the more structured and compiled languages such as C++ and Java. However, Script languages generally take longer to process than compiled languages and therefore, are more useful for shorter programs. JavaScript is typically used in Web site development to do such things as automatically changing a formatted date on a Web page, causing a linked-to page to appear in a popup window and causing text or a graphic image to change during a mouse rollover.
A programmer can write fully-functional JavaScript using a simple text editor. To write fully-functional Java, a Java Developer's Kit is required (Java vs. JavaScript). JavaScript must be placed inside an HTML document to function while Java applets run independently of the HTML document that is calling for them. Because JavaScript is a scripting language, the program reading it interprets exactly what has been written. In contrast, Java is not interpreted directly. Instead, if must be compiled it first, and that's what the browser reads. Unlike traditional compilers, where the source code is converted into native machine code, the Java compiler generates an intermediate bytecode which is independent of any machine. An interpreter known as a Java Virtual Machine is built into the browser to run this code.
Java is a strongly-typed, object-oriented, complex programming language while JavaScript is a loosely-typed language which is much simpler than Java. JavaScript lacks Java's static typing and strong type checking (The differences between Java and JavaScript). JavaScript does support most of Java's expression syntax and basic control flow constructs. Java offers a compile-time system of classes built by declarations. On the other hand, JavaScript supports a run-time system based on a small number of data types representing numeric, Boolean, and string values. Like Java, JavaScript also supports functions, but without any special declarative requirements. JavaScript functions can be properties of objects, executing as loosely typed methods.
Unlike JavaScript, Java programs consist exclusively of classes and their methods (The differences between Java and JavaScript). Java's requirements for declaring classes, writing methods, and ensuring type safety make programming more complex than JavaScript authoring. Java's inheritance and strong typing also tend to require tightly coupled object hierarchies. Java's type safety means that a Java int cannot be case into an object reference and makes it impossible to get at private memory by corrupting Java bytecodes.
Java is considered more secure than JavaScript (Java vs. JavaScript). Java was designed with security being one of the highest priorities. The security mechanism in Java has been built into the Java Virtual Machine that runs Java programs and applets. In scripts written in JavaScript security holes are discovered much more frequently than in Java. And, a JavaScript source can be viewed by anybody A Java source is hidden because it is only the compiled bytecode which the browser uses, although there are Java disassemblers that make it possible to read Java.
JavaScript suffers from portability issues. It can only be fully implemented on Netscape's browser, and only version 3 or greater. It tends to crash earlier versions of this browser. Microsoft's Internet Explorer implements ActiveX, a competitive technology, but does not recognize JavaScript.To avoid browser conflict, designers should create a site that will allow users with different browsers to access different pages according to their browser's ability to view JavaScript
You’re 82% through this paper. Sign up to read the full paper.
Sign Up Now — Instant Access Already a member? Log inAlways verify citation format against your institution’s current style guide requirements.