function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RitikRitik 

Property is defined in a class taking class name as the dataType for list.

Hello,

Can somebody tell me that is below piece of code is correct or not.
And if it is incorrect then let me know with the help of reason(s)

public class className01 {
       public List<className01> cn;
}


In short a vaiable/property is defined in a class taking class name as the dataType for list.



Regards,
Ritik
Rufus RodenRufus Roden
That's fine.  It might seem odd that it's defined inside the very class type that it's referencing but it's not a problem.