Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2006

Tip: Looking for answers? Try searching our database.

JavaScript and Java

Thread view: 
Gregc. - 03 Sep 2006 10:22 GMT
Hi

Is the syntax for JavaScript the same for Java?

Greg
Andrew Thompson - 03 Sep 2006 10:40 GMT
> Is the syntax for JavaScript the same for Java?

No, they are different languages.  (Though some of the
code and method names can look similar).

(moments later..)
Actually, now that I check the definition of 'syntax',
I'll need to ease back from the first answer.

The syntax of Java and JavaScript has a lot of
similarities, but probably no more than the similarities
common to any two randonly chosen, high level,
OO languages.

Andrew T.
Gregc. - 03 Sep 2006 10:56 GMT
> No, they are different languages.  (Though some of the
> code and method names can look similar).
[quoted text clipped - 7 lines]
> common to any two randonly chosen, high level,
> OO languages.

Thankyou.
Alex Hunsley - 03 Sep 2006 10:44 GMT
> Hi
>
> Is the syntax for JavaScript the same for Java?
>
> Greg

There's this site called "Google"....
Searching for "java versus javascript" is probably a good idea.
Gregc. - 03 Sep 2006 10:54 GMT
> There's this site called "Google"....
> Searching for "java versus javascript" is probably a good idea.

Yes, I use a thing called "Google" regularly
Lasse Reichstein Nielsen - 03 Sep 2006 11:53 GMT
> Is the syntax for JavaScript the same for Java?

No.
They have a lot of similarities, probably because they both
took the basic syntax from the C language (or from another
language that took it from C).

Java and JavaScript has less in common that Java and C++
(or Java and C#, or C# and C++, or ...), mainly because
JavaScript is not a class based language like the other.

For the basic flow control statements (if, for, while, do),
which have nothing to do with being class-based or not,
the languages are much closer. If you can read one, you can
probably read another.

/L
Signature

Lasse Reichstein Nielsen  -  lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
 'Faith without judgement merely degrades the spirit divine.'

John W. Kennedy - 03 Sep 2006 21:19 GMT
>> Is the syntax for JavaScript the same for Java?
>
> No.
> They have a lot of similarities, probably because they both
> took the basic syntax from the C language (or from another
> language that took it from C).

There are some aspects of JavaScript that were taken from Java, such as
putting the standard mathematical functions into a name space called
Math (though in the case of Java, the name space is in the form of a
class, and in the case of JavaScript, it is in the form of an object).

Signature

John W. Kennedy
"The blind rulers of Logres
Nourished the land on a fallacy of rational virtue."
  -- Charles Williams.  "Taliessin through Logres: Prelude"

tri - 04 Sep 2006 08:07 GMT
Hi
Greg

Most of the syntax for JavaScript is same as Java. There are many
differences
Like:-
In JavaScript we compare two strings for equality with ==
whereas,
In Java we compare two strings with equals() function.

:-)
Trilochan Singh.
Oliver Wong - 27 Sep 2006 18:13 GMT
> Is the syntax for JavaScript the same for Java?

   They are different. One example of a difference: "class" is a reserved
word in Java, but not in JavaScript.

   - Oliver
Oliver Wong - 27 Sep 2006 18:18 GMT
>> Is the syntax for JavaScript the same for Java?
>
>    They are different. One example of a difference: "class" is a reserved
> word in Java, but not in JavaScript.

   Moments after posting this, I find out that "class" is a "future
reserved word" in JavaScript, for the purpose of possible extensions. So
I'll rephrase the difference as:

"public class Foo {}" (without the quotes) is a legal Java compilation unit,
but not a legal JavaScript compilation unit.

   - Oliver


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.