Doubt in linked list

how to build a heterogenous linked list in java ???

you can do this by creating an array or linked list of elements that encode both the data and the type of data. We could use a struct that includes a type indicator and a union of the various types that we want to handle, and the create an array or linked list of that struct:

you can refer to this article for more