In
Java, there is an import distinction between primitive data types and objects. They are very different. When you wish to store an integer, you need a variable of type int. This always uses exactly 32 bits of memory.
Example: int i = 3452;
If I want to store a
String (BTW In Java, Strings are objects, not primitive data types), you need an object reference variable, and then you have to instantiate the object.
Example:
String str;
str = new String("This is a test");
You can also write it using Java's shorthand notation for calling the String constructor.
String str = "This is a test";
Nonetheless, you are STILL creating an object reference variable of type String, and "pointing" it to a String object. This is different than a simple primitive data type like int.