-
Java vs. JavaScript
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
-
-
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();
Last edited by sjalle; 03-16-2005 at 06:19 PM.
eschew obfuscation
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks