How C# differes from JAVA? Plz give technical differences.
Printable View
How C# differes from JAVA? Plz give technical differences.
1. java is a platform independent when it comes to .net it is not completly platform independent.
2. java doesn't supports pointers where as c# we can.
3. java doesn't supports operator overloading where as c# we can.
Dot can use poinrter but we have to compile it with unsafe keyword in java we can not use system dll file like kernel.dll gdi.dll etc while in dot.net we can do all this .example we can use directx in .net and create commercial games but thats not possible with java although we can use opengl in java as open gl is also platform independent and is found in all type of system. Although .net is built on the same model of java but it allows us to all the thing which we done in c/c++ and use feature specific to windows only . .net is more easier to learn and work than java(i worked on both); .net is more productive than java(means we can achieve more in lesser coding)
Java is influeced by C++ whereas C# is enhaced version of C++.
C# derives from C/C++ with modernization and type safety- to adapt the changes in environment and to implement advances in the art of programming.
In Java the return type ofmain() is void.
whereas in C#, We are not restricted only to void we can also also have int.
In Java pointers does not exist and was not designed to be compatible with any other languge. Although the default for C# code is safe mode , we can declare classes or method to be unsage This enable us to use pointers , structs andstatically allocated arrays.Both the safe mode and unsafe code run in the managed space , which implies no marshalling is incurred when calling unsafe code from safe code.
In Java the main(), if there are no parameters required we still need to incle the command line parameters array. This is not the case with C# we can declare Main() as
public static void Main(){...}
Although Java supports constructors, it doesn't have destructors. Whereas in C# we have destructors to release all the expensive resources even though we have garbage collector, which does the same - isn't invoked immediately after the variable goes out of scope, but only at certain intervals or memory conditions.
In Java it is not possible to declare unsigned integers whereas in C# POS type system i.e., intended to support the complete implementation of a wide range of programming language makes us impossible to declare unsigned integers.
1.By default in dot net 3 thread is started ie App thread,Worker Thread and finalizer thread but in java only one thread is started.
2.In jave no concept of App_Domain bit in dot net it has.
3.In java platform indepency in case of O/s,But in dot net platform independency is for processor.
4.in Java 4 generation og GC but in dot net 3 generation
in addition to above comments,c# is comemrcial prodcut where as java is opensource,
thats why many people had put their hands and made it so popular,
soem of them are
Appache(ant,maven,tomcat,jboss,the most popular framework struts).
IBM(Eclipse,websphere)
orcale (some open apis)
in java u can create whatever u wants
but .net tech u depends on micro soft controls
in Java both compilation and interpretation is there,i.e. source code is compiled to java byte code which is again interpretated by the java interpreter but in .NET ,all codes are compiled no interpretation is there,i.e.-
source code is compiled to MSIL and then again MSIL is converted to machine code using JIT compiler