Can you tell me what does this method return type is:
List<passenger> recommend(Car a, Driver b) { ... }
I just want to know about List keyword. Is this standard linked list or soemthing else.
If i have objects of passenger type. How can I add them in a List?
List in java is an interface. It means that it is not a concrete implementation, but the interface to it.
The concrete implementation the method can return can be LinkedList, ArrayList or any other class which implements the List interface. Read more in javadoc.
Basically, you add the elements to the list using methods add or addAll:
list.add(object);
list.addAll(anotherList);
List is an interface. it can be an ArrayList or what ever implements the List interface
List<passenger> list = new ArrayList<passenger>();
Basically, it contains a list of passengers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With