Presentation is loading. Please wait.

Presentation is loading. Please wait.

Peter Juszczyk CS 492/493 - ISGS. // Is this C# or Java? class TestApp { static void Main() { int counter = 0; counter++; } } The answer is C# - In C#

Similar presentations


Presentation on theme: "Peter Juszczyk CS 492/493 - ISGS. // Is this C# or Java? class TestApp { static void Main() { int counter = 0; counter++; } } The answer is C# - In C#"— Presentation transcript:

1 Peter Juszczyk CS 492/493 - ISGS

2 // Is this C# or Java? class TestApp { static void Main() { int counter = 0; counter++; } } The answer is C# - In C# Main() always starts with an uppercase. In Java it is lowercase.

3  It should be "simple, object oriented, and familiar".  It should be "robust and secure".  It should execute with "high performance".  It should be "architecture neutral and portable".

4  Both C# and Java are designed from the ground up as VMT-based object oriented languages  Syntax similar to C++/C  Both use garbage collection as a means of reclaiming memory resources  Both include thread synchronization mechanisms as part of their language syntax

5  C# allows restricted use of pointers  Code blocks or methods marked with the unsafe keyword  Compiler requires the /unsafe switch to allow compilation of a program that uses such code  Java does not allow pointers or pointer- arithmetic to be used  The arguments to a method are passed by value

6  Both languages support the idea of primitive types  Both treat Strings as immutable objects  C# has more primitive types than Java - unsigned as well as signed integer types supported  Both allow automatic boxing and unboxing to translate primitive data to and from their object form

7  C# allows the programmer to create user- defined value types using the struct keyword  Such value types are allocated on the stack rather than on the heap  Can be seen as lightweight classes  Limitations: no inheritance  Java has no such corresponding concept

8  C# enums are derived from a primitive 8, 16, 32, or 64 bit integer type  Java enums are objects  They are typesafe and can be extended by adding methods or fields

9  In C# an array corresponds to an object of the Array class  Java each array is a direct subclass of the Object class  Both support arrays of arrays (jagged arrays).  C# also has true multidimensional arrays  Increase performance because of increased locality

10  Enables one to define a single class, struct or interface across multiple source files  Useful when dealing with automatically generated code  Automatically generated parts of a class can live in one source file while the user generated parts of the class can live in another  Java has no such corresponding concept

11  Verbatim Strings  Overflow Detection  Explicit Interface Implementation  Friend Assemblies  The Namespace Qualifier  Iterators (Continuations)  Static Classes  Nullable Types  Anonymous Methods

12  Extensions  strictfp  Dynamic Class Loading  Interfaces That Contain Fields  Anonymous Inner Classes  Static Imports

13  The results are in MFlops (mega floating- point operations per second), so higher is better.

14

15

16 For a far more in-depth comparison check out: http://www.25hoursaday.com/CsharpVsJava.ht ml#structs


Download ppt "Peter Juszczyk CS 492/493 - ISGS. // Is this C# or Java? class TestApp { static void Main() { int counter = 0; counter++; } } The answer is C# - In C#"

Similar presentations


Ads by Google