Today, I will describe to you the differences and similarities between Java and JavaScript.
Similarities:
Keywords: Both languages have for and while loops, bitwise operations (OR, AND, ect.), and use the same symbols for basic math (+, -, * , /).
Name (Sorta): This is where many people may get the languages mixed up. They both have the word “Java” in the name.
Differences:
Games: Java comes with classes that you can use to make games with. JavaScript, however, does not.
Purpose: Java’s purpose was to be for everyday applications such as calculators. JavaScript was meant for websites.
Structure: Java is a OO (Object Oriented) language. JavaScript is… you guessed it! Not! EDIT: Not as much. (As some of you have pointed out)
These are only a few of the differences between Java and JavaScript. Now I hope people don’t say “Java is the same as JavaScript” anymore. Have a nice day.
There is no such thing as more object oriented. It is either object oriented or it is not. There is no middle ground… How is java more object oriented than javascript?
You can do all sorts of things that make it seem like its very OO on the surface - that was what Roquen was referring to.
But no, javascript has no OO at all, none.
Its all fake, and if you try to do things that would normally go well with actual objects and pointers you will have some frustrating days debugging
Java is general purpose and fail-fast, javascript is a DSL an fault tolerant. Java is class-based OO and Javascript is prototype based OO. I could go on…but my real point is comparing the two doesn’t make any sense.
Errr… no language comes with classes that you can make games with, actually. What you’re talking about is suns/oracles java standard library. It’s so closely bundled to the JVM that people think the JVM would die without it
On a serious note again: On android you don’t have the standard java library, you have the android library. Something like Swing/AWT doesn’t exist in Android’s Standard libarary, even though you can use Java to for coding on Android.
Also, you can’t write games ‘without libraries’ (what’s the difference between including the code of a library (or writing the exact same code) and installing a library?) with nodejs, for example, but in web browsers it’s easily possible. See modifying the DOM / using HTML 5 Canvas and all the HTML 5 games that exist out there.
Roughly true
I know we already discussed it here, but look at MooTool’s Class, and you’ll see that you can IMPLEMENT something like java’s class system with inheritance and public / private methods and fields in javascript. It’s pretty amazing if you think about it actually: They didn’t implement it in the compiler / interpreter, but you can actually code it in the language itself. You could also modify it, or write your own version if you wanted If you like this simplicity, maybe try out the programming languages scheme or lisp (argh, I did it again!)
Guys, he’s not a troll, he just doesn’t want people to call Java and JavaScript the same ^^ He just wants to do something good.
I’m not claiming that Java sets the standard, but this is Java Gaming, not C++ gaming. I know full well that other languages are Object-Oriented, I’m just focusing on one.
There are a lot of differences between both, but the most notable difference IMO is that Java is strongly typed while Javascript is not.
It’s a nightmare to make big programs with a weak typed language.