I am new to java and was wondering if someone could explain the differences between Java and JavaScript.
Are they the same?
How are they alike?
How are they different?
Is JavaScript only for HTML?
etc.
Thanks
-Zak
Printable View
I am new to java and was wondering if someone could explain the differences between Java and JavaScript.
Are they the same?
How are they alike?
How are they different?
Is JavaScript only for HTML?
etc.
Thanks
-Zak
Any Help??????
Hi Zak,
The syntax between java and javascript is very similar, but thats about it.
Java - variables are declared as int or String or the likes
i.e. int count = 0;
JavaScript - variables are all var (variable) and can be anything
i.e. var count;
Java - is compiled into .class files (faster)
Javascript is interpreted text (slower). Javascript can reside in .html or in .js files
Java requires the Java Runtime Environment to operate
Javascript requires some host (like a web browser) to operate
Javascript is basically only for .html
Basically, the choice between the two will depend on what you are trying to do.
I hope this helps, and hope others will also respond.
James D.
Thank you... it does help.
-Zak
In addition to what JamesOfOOST says; javascript uses loose typing which means
that you don't have to declare your variables at all, which in my opinion is rather
messy.
One more thing: A javascript can invoke publicmethods in a java applet, like if
the applet is named "pageApplet" in the html applet tag (no matter what the class file
is named), and has a public method called "startAnimation()", - then you invoke it
from the javascript like this: pageApplet.startAnimation();