java - Implementing Interfaces and Objects -


when class implements interface, make objects instantiated class perceived object of interface?

i.e. upon class implementing runnable interface, make instances created class called runnable object?

so, runnable object reference variable expected (say, in parameter of method or constructor), why legal can provide instance of class argument method or constructor? because implementing interface, class, in essence, object of interface?

an object of class c implements interface i can called object of interface, although single object can of many interfaces. liskov substitution principle requires c usable anywhere i required, in essence i becomes contract of c, representing subset of cs abilities, applicable situation.

for example, when object implements runnable, run() method in interface presents particular aspect of class java class library - namely, objects of class can "ran" (by calling run() on them). presence of runnable lets code logic of thread independently of java designers, write thread-execution code independently of implementation's logic.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -