All the methods that are available on interface Path are implemented, so you can call them as you like.
Zo Ve wrote:How do you know from API doc. that they are implemented?
(ok, i know that they are implemented somewhere, as far as i can use them, but how can i know that from API doc).
If you gave me an interface, and nothing else, then I would have no indication that the interface has been implemented. If you gave me an interface and a class which returned an object with the type of your interface, then I would know that there is an implementation in your code somewhere. If you don't make that implementation public, then you are telling me that I don't need to know about it, I should just use the method's return value.
Zo Ve wrote:In case of Path interface, you can use those methods as you wish (don't need to implement them if you're satisfied with their implementation). If I use method actionPerformed() as they gave us, it want do nothing, but in case of Path methods, all the methods do something.
Zo Ve wrote:I used term "object of type Path", because of shorter conversation, not because i believe that I can instantiate object from interface.
When I see in API documentation some interface, first thing that comes to my mind is that i have to write class with all implementation of interface methods. But in case of, for example Path interface, those implementations are already written for me. So how can i know for which interface those implementations are written and and for which interface they are not, reading just API documentation.
How can i figure out, what is first place that i have to visit in API doc, when I start to study some package, to get idea where to go to the next place?
Zo Ve wrote:When I read oracle tutorial about File I/O, they say that java.nio.file.Path interface is entry point for java.nio.file package. After that, i go in API documentation to see description for that interface. In description they don't say how can you get objects on which you can use methods of that interface.
Zo Ve wrote:See you on some other topic, with new question (probably about concurrency, that is next topic I am going to study after File I/0).