Netscape ENTERPRISE SERVER 6.0 - PROGRAMMER GUIDE TO SERVLETS Programmer's Manual page 104

Guide to servlets
Table of Contents

Advertisement

Differences Between JavaScript and Java
Java is a class-based programming language designed for fast execution and type
safety. Type safety means, for instance, that you can't cast a Java integer into an
object reference or access private memory by corrupting Java bytecodes. Java's
class-based model means that programs consist exclusively of classes and their
methods. Java's class inheritance and strong typing generally require tightly
coupled object hierarchies. These requirements make Java programming more
complex than JavaScript authoring.
Table B-1
JavaScript
Interpreted (not compiled) by client.
A scripting language that supports objects.
No distinction between types of objects.
Inheritance is through the prototype
mechanism, and properties and functions
can be added to any object dynamically.
Functions may be inside classes but do not
have to be.
Code integrated with, and embedded in,
HTML.
Loosely cast: variable and function types
not declared (dynamic typing).
Cannot automatically write to hard disk.
Semicolons at the ends of statements are
optional.
104
Netscape Enterprise Server Programmer's Guide to Servlets • November 2001
JavaScript and Java compared
Java
Compiled bytecodes downloaded from
server, executed on client.
An object-oriented language.
Objects are divided into classes and
instances with all inheritance through the
class hierarchy. Classes and instances
cannot have properties or methods added
dynamically.
Every method must be inside a class.
Code distinct from HTML, although JSPs
can contain HTML tags.
Tightly cast: variable and method types
must be declared (static typing).
Cannot automatically write to hard disk.
All statements must end with a semicolon
(;).

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise server 6.0

Table of Contents