Why to use primitive types in java instead of Wrapper classes? I want to know that already we have wrapper classes in java, then why we need to use primitive types? What are the importance of primitive types in java?
Your question is backwards. The primitive types are more fundamental than their wrappers.
Really the only useful thing that wrappers give you is the ability to be treated as a subclass of Object (so that they can be put into collections and so on). All the really useful stuff (like arithmetic and ordering) is provided by the primitive type.
Note that while you can say stuff like:
Integer i = Integer.valueOf(4);
Integer j = Integer.valueOf(2);
Integer k = i + j;
this is just a convenience. Underneath, the last line becomes something like:
Integer k = Integer.valueOf(i.intValue() + j.intValue());
so that the arithmetic occurs on the primitive values. (This convenience is known as boxing/unboxing.) There is a performance penalty to this, so that on my machine, this loop:
for (int i=0; i<10000000; i++) { }
is about 10 times faster than this loop:
for (Integer i=0; i<10000000; i++) { }