The fact that Java is different than JavaScript hasn't completely sunk into all of the web design community. I still see the terms used interchangably, even in this forum.
The fact is, they are very different.
Java is a compiled programming language, so it is fast, but you must write the code, save it, and compile it into a class file for it to work.
JavaScript is a scripting language. (i.e. it is not compiled) Rather, it consists of plain text in a web page that is interpreted by a browser. JS interpretation is CPU intensive, thus JS runs slower.
Why do people get the two confused so often? Obviously because of the unfortunate name similarity, but also because they both can run in a browser. Java is loaded into a browser as a separate file called an applet. JavaScript is loaded as part of the web page text, surrounded by <script> tags.
The two languages have different syntax, were created by different people, run differently, and are used in different ways.
In fact, JavaScript was supposed to be called LiveScript, but when Java became popular the name was changed for marketing reasons.
Last of all, note that the creators of JS based some of the syntax on Java to facilitate ease of learning. For this reason, if you want to learn Java but are new to programming, JS is a good stepping stone.
-Petey
The fact is, they are very different.
Java is a compiled programming language, so it is fast, but you must write the code, save it, and compile it into a class file for it to work.
JavaScript is a scripting language. (i.e. it is not compiled) Rather, it consists of plain text in a web page that is interpreted by a browser. JS interpretation is CPU intensive, thus JS runs slower.
Why do people get the two confused so often? Obviously because of the unfortunate name similarity, but also because they both can run in a browser. Java is loaded into a browser as a separate file called an applet. JavaScript is loaded as part of the web page text, surrounded by <script> tags.
The two languages have different syntax, were created by different people, run differently, and are used in different ways.
In fact, JavaScript was supposed to be called LiveScript, but when Java became popular the name was changed for marketing reasons.
Last of all, note that the creators of JS based some of the syntax on Java to facilitate ease of learning. For this reason, if you want to learn Java but are new to programming, JS is a good stepping stone.
-Petey