being able to put field of type link inside the class definition of this same type may seem odd wouldn' the compiler be confusedhow can it figure out how big to make link object if link contains link and the compiler doesn' already know how big link object isthe answer is that in java link object doesn' really contain another link objectalthough it may look like it does the next field of type link is only reference to another linknot an object reference is number that refers to an object it' the object' address in the computer' memorybut you don' need to know its valueyou just treat it as magic number that tells you where the object is in given computer/operating systemall referencesno matter what they refer toare the same size thusit' no problem for the compiler to figure out how big this field should be and thereby construct an entire link object note that in javaprimitive types such as int and double are stored quite differently than objects fields containing primitive types do not contain referencesbut actual numerical values like or variable definition like double salary creates space in memory and puts the number into this space howevera reference to an object like link alink somelinkputs reference to an object of type linkcalled somelinkinto alink the somelink object itself is located elsewhere it isn' movedor even createdby this statementit must have been created before to create an objectyou must always use newlink somelink new link()even the somelink field doesn' hold an objectit' still just reference the object is somewhere else in memoryas shown in figure other languagessuch as ++handle objects quite differently than java in + field like link nextactually contains an object of type link you can' write self-referential class definition in +(although you can put pointer to link in class linka pointer is similar to referencec+programmers should keep in mind how java handles objectsthis usage may be counter-intuitive