Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q4054 What is the difference between Java and JavaScript?

You are here: irt.org | FAQ | Java | Q4054 [ previous next ]

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?'

©2018 Martin Webb