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

9.8. All types are objects

As well as additional unsigned types and a new decimal type, there is another big difference between C# simple types and Java primitive types – C# allows you to treat all types, including value types, as objects. In Java, primitive types are not objects, do not behave like objects, and cannot be treated like objects. If you need an object representation of a primitive type, the Java core library has the following wrapper java.lang classes which can be used in place of the primitives: Byte, Short, Integer, Long, Float, Double, Character, and Boolean.

All types in C# are ultimately objects derived from System.Object. The process whereby CLR converts a simple value type into an object is called boxing. Boxing bridges the ...

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