what is use of using class name as datatype in java

While creating a node in linked list we use class name as type ,why so?

8/18/2019 12:30:11 PM

Indu Devarashetty

2 Answers

New Answer


Indu Devarashetty Because you want to keep a reference to the object of that type. List is list of nodes linked together. Class is just a user defined type. It's usage in terms of declaration/definition is same as primitive datatypes.


whenever you create object from class you must use class as typename