Primitive data types as an object
So I am trying to understand wrapper classes. Just a thought so basically once you get so far with coding you will just start to store any of the primitive data types inside of objects?
Brendon Butler4,238 Points
Primitive data types are a necessary part of Java to tell the compiler what type of variable you have. Other languages allow you to be vague, and the type will automatically be selected.
You still need things such as int, boolean, char, etc. But they are very basic -- only storing the binary values of whatever variable you have. This saves a lot of memory/space as you don't need to instantiate another object class every time you want to store a variable.
These primitive data types have wrapper classes that allow you to access methods to manipulate the primitive data type. For example, you can convert a string to an integer using the Integer class' methods.
int stringToInt = Integer.parseInt("1234");
parseInt method returns an
int that can be stored in a variable or used in a method.
I'm not sure if I directly answered your question, but if not, here's some resources to help you understand the topic a little better: