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 ...
Get From Java to C#: A Developer's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.