A comparison of C-Sharp and Java Zunaid Jogee Supervisor: T. Stakemire
Outline Why? C-Sharp(C#) Java Comparisons Examples Conclusion Questions
Why? Java clone/replacement Handles low level plumbing issues Shared/different features
C-Sharp(1) New Microsoft programming Language “one of our key design goals was to make the C# language component-oriented” Anders Hejlsberg incorporates XML comment tags
C-Sharp(2) Microsoft Intermediate Language (MSIL) Common Language Runtime (CLR) Language Interoperability Compiled language
Java Developed by Sun Microsystems Java Byte Code Java Virtual Machine Platform interoperability Interpreted language
Comparisons Syntax Memory management Efficiency Functionality -Object serialization -Collections -Exception handling
New Features Delegates Unsafe Code Boxing Preprocessor Directives Overflow Detection COM integration
Hello World! Using System ; Class Hello { Public static void Main () { Console.writeLine ("Hello World!"); } } //end of the main import java.io.*; public class MyProgram { public static void main(String[] args) { System.out.println( “Hello World!"); } }
Examples C-Sharp code -Array declarations: int[] iArray = new int[100]; float fArray[] = new float[100]; -Inheritance syntax: class B:A, IComparable{ …} Java Code -Array declarations int[] iArray = new int[100]; float fArray[] = new float[100 ]; -Inheritance syntax: class B extends A implements Comparable { …}
Conclusion C-Sharp is a new Microsoft Programming language C-Sharp - Language Interoperability, compiled Java - platform interoperability, interpreted Comparison with Java
Questions