Waht is the difference between "int" and "Integer" in java ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Waht is the difference between "int" and "Integer" in java ?

What are the primitive data type. Is "String" a primitive data type. The way coding works, i can see that "int" is a primitive data type but "Integer" is not. can anyone explain on this.

24th Feb 2017, 8:38 AM
nirmal kumar vaidhyanathan
nirmal kumar vaidhyanathan - avatar
2 Answers
+ 8
String is a class, Integer is a class, int is primitive, mention the camel case names of the classes. The classes provide useful methods, a primitive doesn't. See http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html?is-external=true for the provided methods of Integer. To handle the boxed primitives also search for 'outboxing' on Google.
24th Feb 2017, 9:25 AM
Tashi N
Tashi N - avatar
+ 2
thanks guys.
24th Feb 2017, 10:52 AM
nirmal kumar vaidhyanathan
nirmal kumar vaidhyanathan - avatar