Answer the question
In order to leave comments, you need to log in
Interfaces and their implementation in java?
I have an API with a findRooms(int price) method and two implementations of BookingAPI and GoogleApi
and have a Controller class and an API[] apis array and a requestRoom(int price) method
here are my attempts:
public class Controller {
API[] apis;
Room[] requestRooms(int price){
int count = 0;
for (API api : apis) {
if (api.findRooms(price, persons, city, hotel) != null) count++;
}//считаю кол-во комнат
Room[] res = new Room[count];// создаю массив для них
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question