Java is an object-oriented language and as said everything in java is an object. But what about the primitives? They are sort of left out in the world of objects, that is, they cannot participate in the object activities, such as being returned from a method as an object, and being added to a Collection of objects, etc. . As a solution to this prob...

Read More

Auto-boxing is the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper classes. For example, converting an int to an Integer, a double to a Double, and so on. If the conversion goes the other way, this is called un-boxing. Here is the simplest example of auto-boxing: char ch = 'a'; ...

Read More

Java draws a strong distinction between objects and primitive types. We can't assign an int (or other primitive) to an Object-valued field. Fundamentally, a Collection class is implemented in terms of objects. A simple ArrayList class might be implemented like this: class ArrayList { Object[] data = new Object[10]; int count = 0; ...

Read More

New developers are often confused by the difference between an primitive int and the Integer wrapper class or boolean vs Boolean, char vs Character, short vs Short, long vs Long, float vs Float or double vs Double etc. Everything described here about the difference between int and Integer applies analogously to char and Character, short and Short, ...

Read More

FOLLOW US ON LinkedIn



Explore Tutu'rself