Phew, it's been a long, long time since I've posted anything here on Newgrounds programming forum. I don't often see anything that intrigues me as much as this thread. I come from a C# background, in the respects that it was my first language and the language I've spent the most time in. While I do not work in Java or have used it for anything, the post by Steel that linked to a Stackoverflow question has some great information on the subject. However, I'd like to provide my own insight, while picking at a few things that weren't touched on in this thread.
The differences between C# and Java are far-and-wide, and this goes beyond syntax; yes, the syntax is different such as how you override a method. There are also developer conventions that differ between the two languages - in Java, I've read that developers are encouraged to implement interfaces for object abstraction instead of parent-child class relationships. That is completely optional, however. No one forces you to utilize this convention, but if what I read is true, then that's something you'll see quite frequently in a large number of projects, and if you maintain one, then you'll have to abide by those conventions. C# doesn't have a similar convention as far as I remember, so you're going to see many applications written with parent-child inheritance. For any real, comprehensive list of differences, please reference Steel's link to Stackoverflow.
Now, here is something that I'm more useful in commenting on for you: which is more useful for making games. The answer begins your platform-targeting desires. For example, if you wish to target Linux, Mac OSX and Windows -- as well as mobile (read: Android) in the future -- then go for Java. Java has its VM just about everywhere. In fact, the JVM is embedded in many, many devices aside from just Android devices (phones or tablets). There are Bluray players, media centers and TVs that use them. Java, for all intents and purposes, is completely cross-platform and is extremely adopted. Because of this adoption/use of Java, Java has a lot of frameworks and libraries available to developers to do just about everything. For reference, Mojang uses Java for Minecraft; Cube World is written in Java; Runescape 2 is written in a modified version of Java.
On-the-other-hand, if you really only care for the Windows market, go for C#. C# has been adopted by Microsoft as if it were the second coming of Jesus. Microsoft implemented a compacted version of their .NET framework on the XBOX 360 for indie developers to play around in (limited and slow sandbox). I believe the .NET Compact Framework is implemented on their Windows 7/8 phones, too. Though, that is to say that games written in C# can't run on Linux or Mac like a game written in Java can, it's just something you don't see wildly done. There is Monogame and OpenTK out there.
The next step is to figure out which type of game you're going to create. You've stated a desire to stay 2D, but are willing to go 3D if necessary. 2D and 3D are agnostic these days. When you create a 2D graphic, you're rarely going to just render a bunch of pixels on screen as-is these days, if at all. Instead, you create a 2D rectangle with vertices and texture it with the image you want to show, complete with alpha blending and any other pixel shader technique you plan on doing (give the texture a brass shine to it). There other techniques that you can use to achieve 2D rendering. While both languages are completely equipped to do this, it's the performance of the language that you must look for. Java is faster than C#, so you might want to use Java. However, I find that the XNA framework is much more easier to dive into than most 3D libraries written in Java, and you can use Java with XNA; it's the same argument people make when picking up Ruby instead of Python because Ruby on Rails is something they connect to much more easily (or understand more) than, say, Django or Flask.
Now is the time I look individual statements post here. PMMurphy, please don't feel like I'm insulting you or picking on you.
At 6/15/13 05:09 PM, PMMurphy wrote:
I havn't studied the frameworks of either language. But i do know that java has issues when it comes to game development.
It would be wiser to say that all languages have issues when it comes to game development. C/C++, for example, have problems with being cross platform. CPU architectures such as x86 have tried combating this, but operating systems are still different from one another. C/C++ code compiled for an x86 platform, but ignorant of differences between Mac and Windows (with a focus on one or the other) won't work on both OSes. A developer writing Java can still cause platform dependance issues, but is, by default, going to run on Mac and Windows without separate code bases.
But it is true that Java has it's issues when it comes to game development. Java is slow, but only 10% slower than C++ is for the most part. For most casual games, this isn't a problem because computers are much more adept at rendering graphics today than 10 years ago, even if the underlying code instructing when something should be rendered or where is written in Java. C# is the same way, too, but terribly more so.
The reason most people don't like java video games is because c++ is simply faster at it. Java forces you to create an object everytime you want to make a method call or make functionality. Where as in c++ you don't have to do this. So there are some aspects where if coded correctly you can speed up the process of the game.
Actually, even though the starting point of a Java application is inside of a static class, and its main is a static method, in an OOP language, everything is an object - even in C++. Given the following code sample:
using namespace std;
int main(int argc, char* argv)
Is actually C code. The above only begins to become C++ when you add in things that are C++-specific, like cout or cin. If you want to avoid creating objects in the way that you're implying when writing in Java, you can just start coding like you normally would. Also, you imply that Java is slow because you are forced to create objects every time you want to add functionality. That is patently false. C++ is faster due to its level of compilation prior to the start of the application. Your code-base is completely static each and every time you run your C++-made applications. Java is slower because of the way it was built - Java compiles somewhat during the build process, then the JVM decides what bytecode to compile down to depending on the system it is running on during runtime ("Oh, an x86 architecture? No problem! Wait, now we run on a x64? Great!").
Lastly, there is one more thing that I must point out. There is no "Android Language" as if you're writing applications in Android. And Java certainly is not "encrypted" into the Android Language. Android is an OS built on top of Linux, and Java is the preferred choice of the OS developer to write Android apps; this is because it is logically an easier language to write an application that is deployed to several different types of devices that run the same OS. Unfortunately, the device fracturing has been greatly increased as the years of gone by, and Android did have its rough start (Java was extremely slow in the early days).
Well, since that is over, let me ask this: since Java and C# have issues of their own, as well as their own benefits, is there is there a clear difference? No, not really. It's which ever suits you better personally these days. If you want to get platform independence go for Java. If you find a library or framework that you meld into better, and it is only available to C#, roll with C#. I hope that this wall-o-text has helped anyone reading it.