O'Reilly logo

From Java to C#: A Developer's Guide by Heng Ngee Mok

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. C# types

Object-oriented purists will argue that C# is 'more OO' than Java in a few ways. One can say that Java is not a pure OO language because it supports primitive types – and primitive types such as Java's int, long, and double are not real objects. (There is, however, a really good reason for not making your ints and longs objects. [1])

[1] Instantiating objects is an expensive process. When you want to perform a simple arithmetic addition, you want to perform the operation on the stack quickly and efficiently. Some programming languages do not have primitives; even integers are represented as objects. When two integers are to be added, two integer objects are actually created in the heap. The process is wasteful if all you want ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required