This is something I did in S3 and had put in my old site….just moved it here for sentimental reasons
This is the notes that I prepared for a seminar that I took at the Cochin dot net user group meeting at Amrita Institute of Technology,Cochin
Introduction
To understand better the various design considerations of languages it is always helps if we look at the basic aims that were in the mind of the designers before when they sat down to ‘make’ the language. In this sense both Java and C# were implemented with somewhat similar objective. Java’ goals are (were) to "provide a simple, robust object oriented secure, easy to deploy cross-platform environment for users building component based software." These aims are consistent with that of .Net Framework(c# too

).
In a book I read (my C# bible till now) "The Complete Reference C#" by Herbert Schildt, the author draws a very humorous analogy between human relations and the languages that we are concerned with. He says if C was the grandfather and C++ the father, then we could say that C# (or Java) is the son and the Java(c#) is the cousin. From what I know this seems to be a perfect analogy since to say that Java is one step behind (or ahead) C# would be injustice to both.
Having said that J and C# are descendent’s of C++ they have some common improvements over the language some o which being -:
1) Garbage collected runtimes -: Even though I don’t have actual programming experience with VC++ and other "scary" languages (framework would be more appropriate), scary due to the urban legends floating around the net about "Memory leaks" and countless crashes, I have some idea of the problem of having to control the memory totally by our (as in the programmer’s) code. Before going further let me say that though this stuff is quite scary it gave the programmer unmatched power (well unmatched at least in Java). This was the problem for most people moving from c++ to Java ‘Oh my god programming with out pointers!!!?" I have heard that this is solved in C# using "Unsafe Code" since I have not used it I have only third party knowledge on it which I will discuss later
2) Tight type checking -: I think that this makes the runtime environment a safer place to live(and flourish) in.
3) Lack of header files -: This is a clear advantage in c# since the programmer need worry only about the logical placement of the libraries he uses and the physical location and organization headaches of lib’s are removed from code. In Java the advantage is to a lesser extent because Java does have a directory-based approach to storing the classes in a package (a package is somewhat similar to a assembly in .Net about which we will discuss later).
4) Lack of forward declaration of classes -: Among other things this means that we can dynamically compile and execute code in our programs (yay!!!)
5) Better adherence to OOP’s (for better or worse??) -: All code is written inside classes and neither global variables or global functions are allowed. Thus some kind of relation exists between otherwise unconnected code. More about it later;)
Working
Java compiles to IL and is at the time of execution loaded by the JVM and is ‘interpreted’.This slows down the whole program But JIT(Just In Time) compilers also exist for java which circumvent this problem. Native compilers are also available for Java for example Opera –The fasted Browser On the Earth" my favorite browser is written in java and has been compiled into native code (for Win*ows and GNU/Linux flavors) and TRULY believe me its – FAST. Well its fast in two senses both program wise and also browsing wise since its has a intelligent method of caching which is a boon for Dial-Up guys like me.(sorry for wandering off). BUT NATIVE compilers, I think, Completely kill the spirit of Java cuz it destroys portability.
.Net working is essentially (at least superficially) same in the sense that the code in any .Net language is converted into IL the Intermediate Language which is quite like the Byte code except for the fact that(I think) sun does not allow ppl to write compilers to convert other languages to byte code. Here is I think one of the main beauties of the .Net framework. MS knows that ppl, especially lazy programmers like me, hate to learn new languages just because some ppl at Sun or MS think that there should be a new language. Hence the flexibility of the IL and licensing that allows other ppl to write compilers of other languages to convert to IL is one of the major Plus point of .Net.Thus while EJB is tied to one language and that too a language owned by Sun,in a restricted manner, The number of languages that support the .Net framework is many and the potential is limiters.But this seems like buttering .Net so let me point out one negative point I see here Even though to say that we can write compilers to convert any language to IL and hence say that that language is a part of .Net is quite easy but if you think about it you will see that each and every language was written with some specific function and audience in mind. Going further in this stream of thought we can see that even IL was written with some basic assumptions in mind about the was things should be organized some other ’stuff’. So naturally if we ,lets say, write a .Net compiler to convert dBase or Foxpro to IL i dont think think that we will same performance we would get if we were to write the same code in C# or any of the ‘Native’ .Net languages. But since I know very less(=NadaZero) about the working of the IL runtime I would like any body’s comments on it. But i think that in 20-30 years from now when history texts will be written about .net( i am not saying it will die by then but still ppl will ask for history like we ask the history of C++ today)The origin of the the cyber saying "All .Net languages are equal, but C# is more equal than others" may be attributed to what i said earlier.So we can say that having only one languages does have its share of advantage.
********TODO********* *****include stuff on how the JIT compilers for java caches and how its different from .net***** ***
Meta Data
Meta data is aces sable in both C# and java using Reflection. but since i know less about this i will get some one else to talk about it or better still i will learn and talk about it later.One thing i know is that in java the reflection is achieved using the package "java.lang.reflect"
Documentation
Both java and .net(C#) allow automatic generation of documentation using comments. Java has a power tool JavaDoc for this while c# compiler generates this using the /out parameter to the compiler.
Portability
the java philosophy has been "Write once, run anywhere" which is also followed by .Net. Just because .Net was initiated by MS does not mean that it will run only on MS platforms, actually Rotor,Mono,.Gnu etc are good examples of .Net framework implemented on different platforms.
Packages ,Namespaces Assemblies……
Java packages have the properties of both Namespaces and assemblies. The main advantage that i can see that .Net has over java in this respect is that Packages dictate the physical layout of the classes(classes are just like .exe or .dll in .Net) (ie java classes are files that have a class declaration inside them and also when compiled form a *name*.class.) where as in .Net the using keyword gives only a ‘hint’ to where the physical location of the Namespaces(and classe etc) is thus removing the physical storage problem out of the code.Also i read that due to this we can have different version of the same namespaces and assemblies existing in the same system without conflict though I am not sure how. So when a program asks for a namespace it will also give out the version number and thus backward comparability issues etc can be solved.This is an assumption and i am sure that the desiger had something else in mind *************TODO FIND ABT THIS*************
Primitive Types’ and OOP’s
Though Java is highly object oriented still it has some primitive types out of the common Hierarchy unlike in .Net where each and everything is a descendent of the object class.Also since Java does not support overloading the wrapper classes cannot be "arthiemeted or logicated"

directly. Wrapper classes are classes which act as a wrapper around primitive types so that they can be treated as objects.this is a huge limitation.
Class Definitions
In java all methods are virtual by default. Hence we can override base class methods in child class without the compiler complaining. In C# we have to use the keyword Virtual in base class and override in child class. Also a non virtual method can be hidden using the special new keyword and java does not have a counter part to this in it. SO why is this said as good when i have to write more code to do the same stuff??? well since we specify about the overridden methods the type of the functions can be determined at compile time whereas in java the same is done at runtime thus making the program slower ( i read this ). ***********TODO MORE ABOUT THIS***********
Delgates and Events
Anybody who has programmed in java knows that it is a little hard to handle mouse events since we have to either Implement the MouseLister interface, which is a bad way if we want to use only one even, or use a MouseAdapter. Even here actually we are registering for all the events but removing the code for unwanted events from our code not the program code. where as in .Net this problem is beautifully solved using Delegates. **************SHOW USING CODE*************
Passing parameters by reference
In java we can pass only by value this works fine untill we have change the value a primitive type or change the object reference. In java this is done by manually Boxing where as this is available in C# as a part of the language.
Java does not have ENUMARATIONS
what else to say about that!!!!
Java does not support PROPERTY
even though we can implement using getXValue(), setXValue() pair of methods..where as in c# this is available as a part of the language.
Indexers
Java does not have this but i am yet to see any use for it so any comments???
Error Handling
In java we have to specify before hand the kind of exceptions a try block will be throwing where as its not required in C# which is better is a matter of debate cuz unless you know what exception the try will throw its not much use using try. however haVing this metadata does not help the programmer that much what do you think?
Arrays
In C# arrays are jagged or rectangular in java all multi-d arrays are jagged.
Switch statement
C# ALLOWS STRINGS IN SWITCH STATEMENTS
Foreach
C# implements the foreach statement for classes extending the IEnuumerable interface *********TODO CONCLUTION************