+ 1
Well, primitive types like int, char, byte ...etc doesn’t use the “reference concept” lets starts with that When you create an object in java, you make a copy from it to the memory, and to reach that copy you have a reference storied also in the memory, and the reference place will wraps in the name that you gave to that object Like that : Object F = new Object(); F (alternative name for where the reference storied) —-> reference ( like a pointer to where the object exists ) ——> Your object ( the copy of the class) Primitive types like int work different , it doesn’t need a reference , it stores directly in the memory Like int x = 10; x ( alternative name for where the value sets in the memory ) If you want to use a reference for primitive types there are classes for them ( Integer for int and so on )
8th Jan 2018, 3:51 AM
Ahmed Salem