Red Hat NETSCAPE ENTERPRISE SERVER 6.0 - NSAPI PROGRAMMER GUIDE Manuel d'utilisateur Page 100

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 124
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 99
Differences Between JavaScript and Java
100 iPlanet Web Server, Enterprise Edition Programmer’s Guide to Servlets • May 2001
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 and Java compared
JavaScript Java
Interpreted (not compiled) by client. Compiled bytecodes downloaded from
server, executed on client.
A scripting language that supports objects. An object-oriented language.
No distinction between types of objects.
Inheritance is through the prototype
mechanism, and properties and functions
can be added to any object dynamically.
Objects are divided into classes and
instances with all inheritance through the
class hierarchy. Classes and instances
cannot have properties or methods added
dynamically.
Functions may be inside classes but do not
have to be.
Every method must be inside a class.
Code integrated with, and embedded in,
HTML.
Code distinct from HTML, although JSPs
can contain HTML tags.
Loosely cast: variable and function types
not declared (dynamic typing).
Tightly cast: variable and method types
must be declared (static typing).
Cannot automatically write to hard disk. Cannot automatically write to hard disk.
Semicolons at the ends of statements are
optional.
All statements must end with a semicolon
(;).
Vue de la page 99
1 2 ... 95 96 97 98 99 100 101 102 103 104 105 ... 123 124

Commentaires sur ces manuels

Pas de commentaire