Design patterns are tried and tested way to solve particular design issues by various programmers in the world. Design patterns are extension of code reuse.
Decorator design pattern which is used in various Java IO classes.
Singleton pattern which is used during runtime.
Calendar and various other classes.
Factory pattern which is used along with various Immutable classes like Boolean e.g. Boolean.valueOf.
Observer pattern which is used in Swing and many event listener frameworks.
Singleton pattern focuses on sharing expensive object in whole system. Only one instance of a particular class is maintained in the whole application which is shared by all modules. Java.lang.Runtime is a common example of Singleton design pattern.
Factory pattern's main benefit is the increased level of encapsulation while creating objects. If one uses Factory to create object one can later replace original implementation of Products or classes with more advanced and high performance implementation without any change on client layer.
Observer design pattern is based on communicating changes in state of object to observers so that they can take there action. Simple example is a weather system where change in weather must be reflected in 'Views' to show to public
Decorator pattern enhances capability of individual object. Java IO uses decorator pattern extensively and classical example is Buffered class say for instance BufferedReader and BufferedWriter which enhances Reader and Writer objects to perform Buffer level reading and writing for improved performance .
Rather a simple question for experienced designer in Java. If one sees implementation of a class has different ways of doing certain things then overriding is the way to go while overloading is doing same thing but with different inputs. Method signature varies in case of overloading but not in case of overriding in java.
Both interface and abstract class follow "writing code for interface then implementation" design principle which adds flexibility in code which is quite important to tackle with changing requirements. Here are some pointers which help you to answer this question:
In Java we can only extend one class but implement multiple interfaces. So if we extend a class we may lost our chance of extending another class.
Interfaces are used to represent adjective or behavior e.g. Runnable, Clonable, Serializable etc. So if we use an abstract class to represent behavior our class won't be Runnable and Clonable at same time because we cannot extend two classes in Java but if we use interface our class can have multiple behavior at the same time.
At a critical time application prefers abstract class as it is slightly faster than interface.
If there is a genuine common behavior across the inheritance hierarchy which can be coded better at one place, then abstract class is preferred. Sometimes interface and abstract class can work together also where we define function in interface whereas default functionality in abstract class.