How to return getStockQuotes()

How to assign TiingoCandle to Candle in lists
??

Hey @yuva if you will see Candle.java is an interface which is having some methods or functions like getDate() or you can say Candle.java is having some function definitions which are implemented in Tiingocandle.java so by using Candle as standard ref you can extract data from any api according to uses about which you will get the idea in later modules.

Read about how Interfaces work and how an implementation of an Interface relates to the Interface itself, you’ll understand how to do that.

just relate your question to this link
https://www.tutorialspoint.com/can-we-cast-an-object-reference-to-an-interface-reference-in-java-if-so-when
Hope you will get some idea about how to proceed and why we are doing this.

The main reason to assign an object to interface reference is to achieve data abstraction and make user disable from modifying data. If you closely look into interface it only consists of getters, not setters. Means a user can only see the data do whatever he wants to do after reading that data but it will not be able to modify any data in an object.

how to initalize List(Candle) temp =temp2;
where temp2 is List(TiingoCandle)

Hey @yuva i think still you have doubt regarding Interfaces and using them so i would suggest go through this link which @akashchhetri has suggested

https://www.tutorialspoint.com/can-we-cast-an-object-reference-to-an-interface-reference-in-java-if-so-when

Hey it has been more than 12 hours since you have replied on this query, so i will be closing this topic. If you still face the same problem feel free to raise a new query. :slight_smile: