- Home /
Java or Javascript?
Hi everybody,
I am very confused....
I have been learning Java for weeks now and I am starting to make first plans for my future game.
BUT then i read an article about Java where somone said that Java and Javascript are two completly diffrent languages ....and the cofusion began...
Then I opened Unity 3d and i saw Javascript and i had the feeling that all the work I have put into Java is nothing worth now.
So to come to a point What is Unity using, Java or Javascript? Or should I switch to C# to avoid confusion?
Note: I do not have a whole lot of scripting expierence and I am actually pretty new to all of this. (besides some Java) Sorry for my bad english. (English is not my first language XD)
Thanks
Learning Java doesn't mean the work you put into it is worth nothing. Learning to program is worthwhile in any language, since most of the concepts are the same even if the syntax isn't.
Answer by Peter G · Feb 24, 2011 at 09:49 PM
Javascript and Java are not closely related by any means, and unfortunately for you, Unity uses javascript. AFAIK (I wasn't even born yet) calling it javascript was just a marketing technique to make it more appealing.
If you think that you have a good understanding of Java, then C# will probably come easy to you. They are both strongly typed with similar syntactical rules. Not to mention that C# has more language features than javascript. But, Unity's implementation of Javascript is more class orientated than web javascript so if you are familiar with the principles of OOP then you will find that learning another object-oriented language won't be that hard if you do want to learn javascript.
I would suggest searching the forums and answers because there has been much debate over js or C#. More people use js, but C# has some more advanced features and the type safety makes it more difficult (not impossible) to write sloppy code. Either way though, you cannot write in Java, sorry.
Thank you very much! You have given me some great advice. Can you answer me on last question please....Is it hard to learn Javascript starting as a total beginner?
Thank you very much.
That's what I did. then I switched to C# for a number of reasons, but learning program$$anonymous$$g concepts is almost more important than the syntax of a language. You should be able to pick up Javascript fairly quickly.
Answer by tertle · Feb 24, 2011 at 10:26 PM
java is completely different to javascript, common mistake.
Lucky for you though, that c# has pretty much identical basic syntax to java so just use that. Obviously a few language specific features but the fundamentals are near identical.
I would suggest using c# over javascript for unity anyway, even if you know both languages.
Answer by _Petroz · Feb 24, 2011 at 10:05 PM
I made this mistake when I first started Unity as well. The other answers seem to have it covered, there are a few amusing answers on stack overflow for a similar question:
Java and Javascript are similar like Car and Carpet are similar.
.
One is essentially a toy, designed for writing small pieces of code, and traditionally used and abused by inexperienced programmers.
The other is a scripting language for web browsers.
Taken from: http://stackoverflow.com/questions/245062/whats-the-difference-between-javascript-and-java
Answer by ThumbStorm · Feb 24, 2011 at 09:48 PM
Unity uses javaScript(which is technically called UnityScript). Java and javaScript are two different languages. Don't feel bad though, I went through the same thing. I learned the JavaScript language for Unity and found it very easy to pick up and there's more documentation on javaScript in unity. Good Luck!
Your answer
Follow this Question
Related Questions
yield WaitForSeconds(); issue--very specific, apparently 2 Answers
Need a link to a Machine gun Script Please 1 Answer
Unity Javascript 3 Answers
When in game, sound is really strange. Help Please!? 2 Answers
oescape script name? 1 Answer