View Full Version : I'm in a java class at school and it got me wondering...

10-09-2007, 05:52 PM
What exactly is the difference between Java and Javascript?

And do you guys have any tips for a newbie? It seems sort of confusing but I'm not quite sure yet.

10-09-2007, 06:00 PM
pretty much the only similarity is the name "java"

java is a full fledged programming language.
this meaning that is can be compiled and ran as an executible, and among other features, it can access various portions of your computer.

Javascript is an interpreted language. meaning it is initiated, ran and dies based upon an instance of a browser. You can see the javascript code in someone's browser because that is where it is ran, and only can run. Javascript is also a loosely typed language meaning you do not have to declare a variable before you use it, and while its bad coding practice, for the most part, it doesn't care about switching variable types (eg float, integer, string, boolean, array) Javascript was originally called ECMAScript, and reformed to LiveScript. the name was subsequently changed to Javascript because at the time Java was a new programming language and it was the "in" fad... it was perceived that anything related to Java was good, and thus the marketing team over at LiveScript converted the name.

now those arent the only difference but from my knowledge those are a good portion of the principle differences.

10-09-2007, 06:12 PM
A few more things--

Java and Javascript are similar in a way, in how they have thing.property.value type statements, but that's about all and describes a number of languages (but not PHP, for example).

It isn't as much that Java was cool at the time, but that Sun Microsystems (owners of Java) wanted to use it for free advertising.

There are a few variations of Javascript, and different implementations in various browsers.

The biggest difference between the languages, as mentioned above, is how they are run. Javascript exists as code and runs in real time from that. Java must be compiled and run after that.

PHP, just to toss that in there, is kinda a weird example, as it is compiled as it is run, and then doesn't keep running, so it's sorta in the middle.

The big thing, then, about client side languages, is that the compiling is completely live.

Javascript, it should be noted, is entirely limited due to securiy, so that makes it very different than most programming languages.

10-09-2007, 06:57 PM
Javascript was originally called ECMAScript, and reformed to LiveScript.No. ECMAScript was later derived as the common factor between major Javascript-ish implementations (e.g. Netscape's JavaScript, Microsoft's JScript).
The big thing, then, about client side languages, is that the compiling is completely live.That's not a client-side language thing. Don't forget, Java applets are also client-side.

As has been said here, Java and ECMAScript are entirely different languages. The very basic syntax is roughly similar, and a few of the methods have obviously been cloned from Java to ECMAScript (e.g. indexOf(), length() [which is a property in ECMAScript]), but you shouldn't expect similarities.

10-09-2007, 07:04 PM
The applets aren't client side... they are compiled.
An application is "client side"... but compiled first.
At lest, that was my meaning. Perhaps an applet is technically client side in terms of web design.

10-09-2007, 08:28 PM
I don't have a clue what you're talking about. Client side: runs on the client (with relation to a given client/server transaction, such as HTTP). Applets definitely fall under this definition. Applets are compiled, interpreted (they are compiled to bytecode), and client-side.

10-09-2007, 09:14 PM
Fair enough.
My meaning was varied, albeit incorrect. I was describing the end-user's involvement in the compiling/parsing [of code] processes.

10-09-2007, 10:28 PM
That's got nothing to do with where the compiled code runs.

10-10-2007, 02:50 AM
Client side compiling, then.
That IS the big difference.