I have just started learning java from Thinking in Java 4th ed.
I read in chapter 2 about wrapper classes and autoboxing but i am unable to understand it.
Please explain it for me in simple words.
I am giving here the text.
posted 6 years ago
Java supports primitive data types such as byte, short, int, long, boolean etc. Since Java is a Object Oriented Programming language it provides a special class for each of the data type known as wrapper classes. For example, for int you have Integer, for long you have Long, for boolean you have Boolean and so on. Wrapper classes provide you the mean to convert a primitive type into corresponding wrapper type and vice versa. They also contain many utility methods in addition. For details you can refer to java documentation.
Autoboxing is a feature of Java SE 5, which automatically does the conversion between a primitive type to its wrapper type and vice versa. In your given example the following:
char c = ch;
won't work in the versions of java prior to Java SE 5. For the previous versions you explicitly need to write the code for conversion.