Jump to content
Killersites Forums

The Main Difference between Java Scripts And Java.....


Recommended Posts

JAVASCRIPTS IS NOT A JAVA:

 

Java is a compiled language. This means that the Java code must be transformed ("compiled") into a high-level programming language before it can run.

 

JavaScript is an interpreted language. It doesn't need to be compiled before it is run. In an interpreted language the instructions are parsed (divided into small components that can be analyzed). For instance, as the browser "reads" this page, it breaks down each of the page's components into individual components and interprets each component as it moves down the page. In linguistics it means to divide language into small components that can be analyzed. For example, parsing this sentence would involve dividing it into words and phrases and identifying the type of each component (such as a verb, adjective, or noun).

Link to post
Share on other sites

First of all it is "Javascript" not "Java Scripts".

 

Second, the differences go far beyond how the machine handles execution of the code. Java is a strongly typed language following the classical inheritance model. Javascript is a weakly typed language, and uses the prototype inheritance model.

 

Java was created by Sun Microsystems as a "write once, run anywhere" language, and it achieves that goal by running inside a JVM - Java Virtual Machine. It is indeed a compiled language, as you cannot run Java from source, but the argument can be made that it is also an interpreted language, as the compiled source - bytecode - is not run natively, but rather interpreted by the JVM.

 

Javascript was originally developed by Brenden Eich at Netscape, as a browser-based, client-side language. It was first called "LiveScript", and I've heard many theories on why the name was changed. The language, however, has little in common with Java.

 

The differences between compiled and interpreted code will be lost on most entry-level programmers. The best advice is simply to ignore Java until you have a grasp of Javascript, and know the difference between client-side and server-side. Java may be used as a server-side language, alone or in combination with JSP - this is perfectly acceptable, and is often done in corporate environments, but most independent developers use PHP or other open-source language (Python, Perl, Ruby, etc.)

 

There are, of course, ways to embed Java into a webpage. The number of users without Java support far outnumber those without javascript support, though. I can't think of a reason to write a modern application with client-side Java.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...