Good Afternoon, i would like to ask regarding the methods to use string as reference.
Let say, that i got two object of type LinkedList named ChinaShip and HongkongShip
Normally, if i wanted to access a method (for example getFirst())
i will type ChinaShip.getFirst()
Now, let say that in other object, i got a variable Destination which content is a String.
The example of the Content will be China and Hongkong
Is it possible to use the content of the variable as the name for accessing the LinkedList object?
my approach first would be concatenate the variable first, which will be Destination + "Ship"
This will produce a string which is ChinaShip and HongkongShip
The reason i'm doing this way rather than comparing the string is that the Destination consist of hundreds of posibilities.
Thank You Very Much.
Regards,
Mapof some kind