0
Java attributes
Can i name an attribute by its class name .. for example if i have a class called Class Box{ Int data; Box next; <--- this is my point ! Box(); }
2 Answers
+ 3
Mahmod El-Shambaky
I don't think it is good to make a attributes of class itself because we already set and get data using setter and getter method of class.
But we can make attributes of Class, attributes of ArrayList of class object, attributes of HashMap of class in other class and make setter, getter method and access the data.
You can see this example
https://code.sololearn.com/cLYhMf8l8jLp/?ref=app