interface - how to bring abstraction in java application..logic for abstraction in project -


i know abstract classes , interfaces in java want know how bring abstraction in working software/project? how thing in such way brings abstraction.

your question vague @ best, usage of interfaces helps abstraction because not working concrete types. instance:

iprinter p = printerfactory.getprinter(conditions); ... p.print(content); 

in below line, not aware of what printer using. since using logic, not care. care factory give printer after , print method print content right stream.

if want change printer being used, make amendments in factory class different iprinter implementation need (which in case print other media). mean have changed outcome of piece of code without changing of it.


Comments

Popular posts from this blog

C# random value from dictionary and tuple -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -