Java vs. JavaScript


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Java vs. JavaScript

Hybrid View

  1. #1
    Join Date
    Oct 2004
    Location
    Baltimore MD
    Posts
    69

    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

  2. #2
    Join Date
    Oct 2004
    Location
    Baltimore MD
    Posts
    69

  3. #3
    Join Date
    Feb 2004
    Posts
    31
    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.

  4. #4
    Join Date
    Oct 2004
    Location
    Baltimore MD
    Posts
    69
    Thank you... it does help.

    -Zak

  5. #5
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    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 07: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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center