Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

C# or java


Officer Johnson
 Share

Recommended Posts

java runs on a virtual environment, personally I don't like java because of how it's run, it's a great language syntax wise, however I also don't like it's compilation or methods of Object Orientation. On the other hand, it is VERY similar to C#, but C# doesn't run in a virtual environment such as JRE (Java Runtime Environment). C# doesn't have specified allocated memory either, in 32bit java your maximum ram allocation limits you to only 2GB of ram, so it's rather bad to use with older machines.

Personally I HATE microsoft with a fiery passion. But I have to admit, C# is one of my FAVORITE languages. It has the perfect syntax in my mind, and runs great. And now that it's cross platform thanks to mono develop (or Xanaria Studios if you're on windows), which can be found at [http://monodevelop.com/](http://monodevelop.com/) . I do have to say I favor C#.

If you're looking into mobile development however, I think android uses java, Windows Phone uses C#, and IOS uses Objective C. So really if you're looking to be a mobile developer, take your pick there.

Long story short, I personally dislike java, and would prefer C# over most other languages, but that's a personal preference. HOWEVER, do note that java is probably easier debugging as well because it's in a virtual environment.

It's really among your preference, but there is a decent bit of information about the languages. Either way the syntax is practically the same as Abhi2011 stated. so if you learn one you practically know them both.

If you stick to C#, go C# mono, NOT Visual Studio, it's best to get in the habit of cross-platform programming now.
Link to comment
Share on other sites

> Both are basically the same. C# is a Microsoft's try at Java.

That's complete bullshit. You know nothing about C#. Besides Microsoft overseeing the actual development of the language, it really has nothing to do with them, as long as you don't use their libraries (which were ported over into C# AFTER the language was created). If you want an MS-hands-off approach to C#, you can use the mono libs, which then also make your project cross-OS compatible.

It has nothing to do with java. You should be ashamed of yourself.
Link to comment
Share on other sites

```
void doSomething() {
// Java
}

```
```
void doSomething()
{
// C#
}

```
Java would be more easier to [multiplatform](https://www.java.com/en/about/) since it runs on almost every platform, even your TV (if its a newer TV) runs java O.o

Once you learn one the other one is extremely easy to learn since the syntax is almost exactly the same.

[http://msdn.microsoft.com/en-us/library/ms836794.aspx](http://msdn.microsoft.com/en-us/library/ms836794.aspx)

@Chief microsoft was 'Influenced' by java. The syntax of java was created in 95 while c# appeared in 2000 with the same exact syntax.
Link to comment
Share on other sites

> ```
> void doSomething() {
> // Java
> }
>
> ```
> ```
> void doSomething()
> {
> // C#
> }
> ```

I won't even comment on your "exact same syntax" comment… but I want you to know how derp the above is. You do realize that the placement of curly brackets is ENTIRELY up to personal preference, right? -- rendering your example useless. Not really sure why you thought that was a good representation of the two languages.
Link to comment
Share on other sites

> I won't even comment on your "exact same syntax" comment… but I want you to know how derp the above is. You do realize that the placement of curly brackets is ENTIRELY up to personal preference, right? -- rendering your example useless. Not really sure why you thought that was a good representation of the two languages.

O.o? Yea I know that wasn't the point of my post they look very similar any way you put it. More examples:

```
for(int i=1; i<10; i++){
// Java
}

for(int i=1; i<10; i++) {
// C#
}

```
```
if (condition) {
// c#
}

if (condition){
// Java
}

```
```
-
package com.package;

public class Main {

public static void main(final String[] args) {
// Java
}
}
-
using System;

namespace Name.Space
{
public class Main
{
static void Main() {
// C#
}
}

```
Do you need more examples?
Link to comment
Share on other sites

> java runs on a virtual environment, personally I don't like java because of how it's run, it's a great language syntax wise, however I also don't like it's compilation or methods of Object Orientation. On the other hand, it is VERY similar to C#, but C# doesn't run in a virtual environment such as JRE (Java Runtime Environment). C# doesn't have specified allocated memory either, in 32bit java your maximum ram allocation limits you to only 2GB of ram, so it's rather bad to use with older machines.
>
>  
>
> Personally I HATE microsoft with a fiery passion. But I have to admit, C# is one of my FAVORITE languages. It has the perfect syntax in my mind, and runs great. And now that it's cross platform thanks to mono develop (or Xanaria Studios if you're on windows), which can be found at [http://monodevelop.com/](http://monodevelop.com/) . I do have to say I favor C#.
>
> If you're looking into mobile development however, I think android uses java, Windows Phone uses C#, and IOS uses Objective C. So really if you're looking to be a mobile developer, take your pick there.
>
>  
>
> Long story short, I personally dislike java, and would prefer C# over most other languages, but that's a personal preference. HOWEVER, do note that java is probably easier debugging as well because it's in a virtual environment.
>
> It's really among your preference, but there is a decent bit of information about the languages. Either way the syntax is practically the same as Abhi2011 stated. so if you learn one you practically know them both.
>
> If you stick to C#, go C# mono, NOT Visual Studio, it's best to get in the habit of cross-platform programming now.

C# and all .NET languages run on something called the [CLR](http://en.wikipedia.org/wiki/Common_Language_Runtime) which is equivalent to the JVM

> Both are basically the same. C# is a Microsoft's try at Java.

This is incredibly true.. Many people believe that C# is a better language than Java because Microsoft had the advantage of looking at Java before developing C#. Mono is not as good as Java, it's a great project but will probably never be as good as Java unless Microsoft fully backs and embraces it (and why would they?). If you want your program to run well on different OS's use Java else use whichever one you like better.
Link to comment
Share on other sites

> That's complete *. You know nothing about C#. Besides Microsoft overseeing the actual development of the language, it really has nothing to do with them, as long as you don't use their libraries (which were ported over into C# AFTER the language was created). If you want an MS-hands-off approach to C#, you can use the mono libs, which then also make your project cross-OS compatible.
>
>  
>
> It has nothing to do with java. You should be ashamed of yourself.

This is true, microsoft does only oversee it, and it's not really microsoft without the libraries, but I mean really, most of the microsoft .net libraries for C# are cross platform with mono. Idk if chief was calling me out, but As I stated, the only thing I find similar was the syntax, the languages them selves are VERY different. If you work with one you can get the syntax of the other, HOWEVER, you need to be careful with memory allocation.

> C# and all .NET languages run on something called the [CLR](http://en.wikipedia.org/wiki/Common_Language_Runtime) which is equivalent to the JVM
>
>  
>
>  
>
> This is incredibly true.. Many people believe that C# is a better language than Java because Microsoft had the advantage of looking at Java before developing C#. Mono is not as good as Java, it's a great project but will probably never be as good as Java unless Microsoft fully backs and embraces it (and why would they?). If you want your program to run well on different OS's use Java else use whichever one you like better.

Unknown, I KNOW you did not just say CLR is equivelent to the JRE, JRE is complete and utter * compared to CLR. And I call BS Mono runs GREAT. Mono > Java, without a doubt. If you wanna run cross platform, use mono. Java is so stupid for game design it's not even funny, like the ONLY thing I really like java for is modifying premade applications. for JARS, but if you wanna use plugins, DLL's are better to use as plugins anyway.

Just a clear-up, in case you want to make a valid point of CLR compared to JVM, First of all Java's Runtime doesn't declare generic types, it practically relates everything, List in java is the same as List because it won't declare these as generic types. Will java throw an error still? Yeah, but only because the Java Runtime throws for it because string and object value types aren't matching classes. But in C#, List is a COMPLETELY different type from List, in java it's a compiler thing that controls the "different" types.

So what's this mean? 

It means that you can't have 2 generic types with the same name. You can't have 2 network objects, 2 int objects, 2 strings objects, so on and so forth if their only difference is whether they accept a List or a List For example.

You can't have a class Network with a constructor that contains a definition for List and another class network with a constructor that contains a definition for List and expect JVM to understand that they're 2 different classes.

And there are other differnces too, which get into the delegates behind C#, the conveneincy of properly multi-threading your software, yielding your software.

CLR allows you to define new value types as structures (struct) while java has a fixed set of value types.

and as stated before… 32bit memory allocation
Link to comment
Share on other sites

> For example.
> You can't have a class Network with a constructor that contains a definition for List and another class network with a constructor that contains a definition for List and expect JVM to understand that they're 2 different classes.
>
> And there are other differnces too, which get into the delegates behind C#, the conveneincy of properly multi-threading your software, yielding your software.
> CLR allows you to define new value types as structures (struct) while java has a fixed set of value types.
>
> and as stated before… 32bit memory allocation


You can't have the classes with the same name declared in Java package. But you can have a class called 'Network' and 'network' in the same package. These two can have two different constructors. I think you meant to say two different constructors/methods of the same name with two different parameters like List and List isn't allowed in java. (I don't know if it is allowed.)
Link to comment
Share on other sites

> This is true, microsoft does only oversee it, and it's not really microsoft without the libraries, but I mean really, most of the microsoft .net libraries for C# are cross platform with mono. Idk if chief was calling me out, but As I stated, the only thing I find similar was the syntax, the languages them selves are VERY different. If you work with one you can get the syntax of the other, HOWEVER, you need to be careful with memory allocation.
>
>  
>
>  
>
>  
>
>  
>
> Unknown, I KNOW you did not just say CLR is equivelent to the JRE, JRE is complete and utter * compared to CLR. And I call BS Mono runs GREAT. Mono > Java, without a doubt. If you wanna run cross platform, use mono. Java is so stupid for game design it's not even funny, like the ONLY thing I really like java for is modifying premade applications. for JARS, but if you wanna use plugins, DLL's are better to use as plugins anyway.
>
> Just a clear-up, in case you want to make a valid point of CLR compared to JVM, First of all Java's Runtime doesn't declare generic types, it practically relates everything, List in java is the same as List because it won't declare these as generic types. Will java throw an error still? Yeah, but only because the Java Runtime throws for it because string and object value types aren't matching classes. But in C#, List is a COMPLETELY different type from List, in java it's a compiler thing that controls the "different" types.
>
> So what's this mean? 
>
> It means that you can't have 2 generic types with the same name. You can't have 2 network objects, 2 int objects, 2 strings objects, so on and so forth if their only difference is whether they accept a List or a List For example.
>
> You can't have a class Network with a constructor that contains a definition for List and another class network with a constructor that contains a definition for List and expect JVM to understand that they're 2 different classes.
>
> And there are other differnces too, which get into the delegates behind C#, the conveneincy of properly multi-threading your software, yielding your software.
>
> CLR allows you to define new value types as structures (struct) while java has a fixed set of value types.
>
> and as stated before… 32bit memory allocation
>
>  
>
> * In your original post you said that .NET does not run in a virtual machine.. it does in the same way that Java does, which is why I mentioned the CLR.
> * Yes, there is a 64 bit JRE.
> * On Java vs Mono
>
> * Mono is not developed by Microsoft so it will always lag behind the current .NET version. Java is installed on more Linux distros by default so the user doesn't have to download it (this is beginning to change for Mono). The tooling for Mono is obviously not as good as Java. If I write something in Java it just works everywhere across a consistant JVM, if I write something with C# I have to choose Mono or the real runtime built by Microsoft and there are some incompatibilities between the two.. It's clearly handicapped and I don't blame Microsoft, why would they support a project that allows development on different operating systems? That being said I think Microsoft is beginning to change, and maybe in the future with Microsoft's support Mono will be better, and a more viable alternative to Java for cross platform applications.
>
> Your example may be true (or it may not I don't write much Java), but I can point you in a million ways the JVM is better too so I'm just going to link to some [summarized differences](http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Java#Summarized_differences).. C# is great in some ways, in other ways Java is good. These differences don't really sway me from one language to another because they're incredibly minor things like you mentioned. What does sway me is portability which I believe right now Java has the upper hand in but maybe in the future Mono will improve.
>
>  
>
> To summarize @Officer Johnson: I dislike both languages but use Java if you want better cross platform support. Additionally, both are equally easy for beginners to get started with which is probably all you really care about, so flip a coin and learn something.
Link to comment
Share on other sites

Arguing about what language to use is silly. A real programmer uses whatever language will accomplish the job best. Most have at least 3+ languages under there belt. The most common I see in every day work is: C++, C#, Javascript, ObjectiveC and Python. (In that general order)

Python is mostly used for little scripts that are run.
Link to comment
Share on other sites

I use **JavaScript**/Node for all personal projects.

I know and can use, but try (hard) to avoid **PHP**.

I can use/manipulate **C#**, but still have soo much to learn.

Languages I don't want to learn:

**Python**, **C++**

Languages I would learn if it made sense to:

**Red**, **Scala**, **D**

Languages I may still learn in the future, because I want to:

**Java**, **Ruby**

There are so many tools. As Marsh said, "A real programmer uses whatever language will accomplish the job best"
Link to comment
Share on other sites

> @Unknown: If you dislike C# and Java, what language do you prefer, out of curiosity? If you say C++, I'll be so confused. It looks so much harder to use, lol

I hate C++ and would not ever want to work in it primarily because I hate managing memory and I don't think C++ is an improvement over C. I'm a RoR developer IRL therefore I also generally dislike Python (whitespace) and I like Ruby.. Ruby is a really cool language. I've also been doing a lot of Coffeescript transpiled to ES6 compiled to Javascript lately with Ember-CLI. Ember is nice for web development especially if you believe in convention over configuration. Javascript is bad, but ES6 modules + Coffeescript helps hide the warts. I'm looking to do more functional programming in languages like Go, Rust or Scala, all of which are incredibly cool. In my experience Java and C# are highly used in industry, Python is also used quite a bit and Ruby is used for startups which is eventually where I see myself going. If you're smart you can work with whatever language you want irl, you don't have to choose Java because there are more jobs in Java.

EDIT:

Hey wait you said Python is great [here](http://www.eclipseorigins.com/community/index.php?/topic/135836-dont-know-where-to-start-programming-please-help#post_id_926772)…

>! I realize it seems odd that I said Python sucks here and advocated the use of Python elsewhere haha… So I assume most people here are heavy Windows users. You do not want to use Ruby or Rails on Windows, period.. You're going to have a bad time, just trust me. Also I think it may be easier for newbies to read Python code it contains a lot less 'magic', and has consistant whitespace syntax. I would advocate Python to a newbie but not willingly use it myself.
Link to comment
Share on other sites

Don't be hating on JavaScript. I absolutely love it, even if it behaves in a manner that makes no sense, relative to other languages. Also, with ES6 standards, it's becoming even more exceptional. We finally get classes! lol. I'm a front end developer, so I use JS almost every day. I'm not fond of coffeescript, though. I'd sooner use Dart than coffeescript. I would also never use Typescript, simply because. lol
Link to comment
Share on other sites

With the creation and popularity of Mono and MonoGame (Xamarin as a whole) I'd say portability is no longer something to be concerned about with C#.  The kicker is that knowing Java gives you a headstart on developing for Android devices whereas C# gives you everything and anything you'd ever want for Windows, Linux, and Mac OSX (desktop and Windows mobile devices).  So the question I'd pose to you is this:

What market segment do you want to involve yourself with?  Desktop or mobile?  Maybe both?  For games there's honestly no question: C# and Unity make one heck of a pair and it's Microsoft's solution for independent developers that want to drop their titles on the Xbox One. [http://www.xbox.com/en-us/Developers/id](http://www.xbox.com/en-us/Developers/id)

Just want to learn a language?  Flip a coin and enjoy the ride. :)
Link to comment
Share on other sites

Java is better at web-based operations than C# typically. C# is better at other things like functionality within the IDE and such. Visual Studio is hands down the best IDE in the world. Maybe you can run Java in Visual Studio, but I do not think it is possible. IDE is very important to keep in mind.
Link to comment
Share on other sites

> Java is better at web-based operations than C# typically. C# is better at other things like functionality within the IDE and such. Visual Studio is hands down the best IDE in the world. Maybe you can run Java in Visual Studio, but I do not think it is possible. IDE is very important to keep in mind.

A few years ago I would agree with you, but what it boils down to now is nothing more than cost of production. A Linux box by nature will always be less expensive than a proprietary OS (in a production environment where millions of consumer dollars are being managed id choose windows server hands down).

I do agree with you when it comes to Visual Studio; C# code completion and all of the other syntactic sugar going on that greatly enhances a developers ability to produce quality code is second to none.

PS. Mono supports ASP.NET; I believe it even has EF (entity framework). :)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...