Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q4054 What is the difference between Java and JavaScript?

irt.org | Knowledge Base | Java | Q4054 [ previous next ]

Q4054 What is the difference between Java and JavaScript?

Besides being compiled and having access to the same set of objects JavaScript does, there are other significant differences:

Static Binding:

In JavaScript, you are able to refer to object in your script that may not exist when the script is first loaded and checked for error. In Java, a program will not compile unless all objects being referred to exist at the time of compilation.

Robert MacNeill replies:

It is indeed possible to make use of a class with a Java application that does not exist at runtime - use:

Class.forName( myClass ).newInstance()

where myClass is the classname and package of the class in question. This is useful for specifying classes that implement an interface.

Object - Oriented:

JavaScript implements only a limited object model, Java takes this further to include classes and inheritance - two important aspects of true object - oriented programming.

Graphics and GUI capabilities:

Java provides graphics primitive and the ability to generate GUI elements that are not available in JavaScript.

Java programming can be more complex and require more rigorous debugging and organisation than JavaScript Scripts.

At the same time it is possible to write complete standalone application and perform actions not possible in JavaScript.

Feedback on 'Q4054 What is the difference between Java and JavaScript?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.