ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

What is difference between C# and java.?

Object oriented programming concepts

user-image
تم إضافة السؤال من قبل faizullah khan faiz , React Native Developer , blue horn tech
تاريخ النشر: 2018/08/29
Mohd Arif Khan
من قبل Mohd Arif Khan , Senior Associate Experience Technology Level 1 , Sapient Corporation Pvt. Ltd.

Differences:

Java is Open source while C# not( that's why Java have one of the larges community)

Java is platform independent( you can run Java application anywhere Linux, Mac, windows, etc.) while C# can be run only on the limited platform like Windows

For Java application, there are too many servers like Apache Tomcat, Weblogic, Websphere, etc. while the C# application can be run only on IIS

Most of the frameworks of Java are the free and open source while in C# a limited choice available

C# follow most of the OOPS concept while Java lesser than C# like C# does not have the primitive type

 

 

Shazibali Gesawat
من قبل Shazibali Gesawat , Full Stack Developer , Self Employed

Both C# and Java are Object Oriented Programming Languages.

 

If i were to compare Java 7 and c#3.

 

It would be as follows.

 

Comparing Java 7 and C# 3

(Some features of Java 7 aren't mentioned here, but the using statement advantage of all versions of C# over Java 1-6 has been removed.)

Not all of your summary is correct:

  • In Java methods are virtual by default but you can make them final. (In C# they're sealed by default, but you can make them virtual.)
  • There are plenty of IDEs for Java, both free (e.g. Eclipse, Netbeans) and commercial (e.g. IntelliJ IDEA)

Beyond that (and what's in your summary already):

  • Generics are completely different between the two; Java generics are just a compile-time "trick" (but a useful one at that). In C# and .NET generics are maintained at execution time too, and work for value types as well as reference types, keeping the appropriate efficiency (e.g. a List<byte> as a byte[] backing it, rather than an array of boxed bytes.)
  • C# doesn't have checked exceptions
  • Java doesn't allow the creation of user-defined value types
  • Java doesn't have operator and conversion overloading
  • Java doesn't have iterator blocks for simple implemetation of iterators
  • Java doesn't have anything like LINQ
  • Partly due to not having delegates, Java doesn't have anything quite like anonymous methods and lambda expressions. Anonymous inner classes usually fill these roles, but clunkily.
  • Java doesn't have expression trees
  • C# doesn't have anonymous inner classes
  • C# doesn't have Java's inner classes at all, in fact - all nested classes in C# are like Java's static nested classes
  • Java doesn't have static classes (which don't have any instance constructors, and can't be used for variables, parameters etc)
  • Java doesn't have any equivalent to the C# 3.0 anonymous types
  • Java doesn't have implicitly typed local variables
  • Java doesn't have extension methods
  • Java doesn't have object and collection initializer expressions
  • The access modifiers are somewhat different - in Java there's (currently) no direct equivalent of an assembly, so no idea of "internal" visibility; in C# there's no equivalent to the "default" visibility in Java which takes account of namespace (and inheritance)
  • The order of initialization in Java and C# is subtly different (C# executes variable initializers before the chained call to the base type's constructor)
  • Java doesn't have properties as part of the language; they're a convention of get/set/is methods
  • Java doesn't have the equivalent of "unsafe" code
  • Interop is easier in C# (and .NET in general) than Java's JNI
  • Java and C# have somewhat different ideas of enums. Java's are much more object-oriented.
  • Java has no preprocessor directives (#define, #if etc in C#).
  • Java has no equivalent of C#'s ref and out for passing parameters by reference
  • Java has no equivalent of partial types
  • C# interfaces cannot declare fields
  • Java has no unsigned integer types
  • Java has no language support for a decimal type. (java.math.BigDecimal provides something like System.Decimal - with differences - but there's no language support)
  • Java has no equivalent of nullable value types
  • Boxing in Java uses predefined (but "normal") reference types with particular operations on them. Boxing in C# and .NET is a more transparent affair, with a reference type being created for boxing by the CLR for any value type.

This is not exhaustive, but it covers everything I can think of off-hand.

Ahmed Ezat
من قبل Ahmed Ezat , محاسب مالي , جلاكسي

C# and java both were derived from C++, and therefore they have similar roots, both are widely used for web programming. We discuss the difference between C# and java these are as follows:

 

C# has more primitive datatypes

Java uses static final to declare a class constant while C# uses const.

Java does not provide for operator overloading.

C# supports the struct type and java does not.

Unlike java, all C# datatypes are object.

C# provides static constructors for initialization.

In java, parameters are always passed by value, c# allows parameters to be passed by reference by Ref keyword.

C# includes native support for properties, java does not.

Java does not directly support enumerations.

In java, the switch statement can have only integer expression, in C# supports integer and string both.

asad rauf
من قبل asad rauf , Computer Operator , DC OFFICE FINANCE AND PALNNING

JAVA is Object-Oriented while C is procedural. ... Most differences between the features of the two languages arise due to the use of different programming paradigms. C breaks down to functions whileJAVA breaks down to Objects. C is more procedure-oriented whileJAVA is data-oriented.

Agnivesh Rana
من قبل Agnivesh Rana , Full Stack Developer , Optum Global Solutions [United Health Group]

Java is an object oriented language developed by sun microsystems  and now taken over by oracle.

C# is the object oriented language developed by Mircosoft

Mounir Salem
من قبل Mounir Salem , تقني , it et is services

C# is an object-oriented programming language developed by Microsoft that runs on .Net Framework. 2)Java programming language is designed to be run on a Javaplatform, by the help of Java Runtime Environment (JRE).

hanadi Lafi Abu-Sabelah
من قبل hanadi Lafi Abu-Sabelah , متدرب , App Trainers

  • C# implements properties as part of the language syntax.

    C# allows switch statements to operate on strings.

    C# allows anonymous methods providing closure functionality.

    C# allows iterator that employs co-routines via a functional-style yield keyword.

    C# has support for output parameters, aiding in the return of multiple values, a feature shared by C++ and SQL.

    C# has the ability to alias namespaces.

    C# has "Explicit Member Implementation" which allows a class to specifically implement methods of an interface, separate from its own class methods. This allows it also to implement two different interfaces which happen to have a method of the same name. The methods of an interface do not need to be public; they can be made to be accessible only via that interface.

    C# provides integration with COM.

abdelmoneim abdalla abaker kose
من قبل abdelmoneim abdalla abaker kose , IT Department Manager , Ministery of education

The deferents between C# and java are - java is object-oriented while C is procedural -JAVA is an interpreted language while C is compiled language - Java is high-level language while C is law-level language - JAVA breaks down to objects while C breaks down to function

مستخدم محذوف‎
من قبل مستخدم محذوف‎

They are both Object Oriented, different developers. C# runs on .Net while JAva is on Java Platform

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟