OOPs and Design Pattern interview questions
- "is-a" relationship describes inheritance relationship between objects view answer
- has-a relationship, which is also called object composition view answer
- The four main concepts are involved in OOP view answer
- Example Java Code For Association & Aggregation & Composition view answer
- What are the common things need to consider while Creating and Destroying Objects view answer
- what is the difference between encapsulation and data hiding? explain with Code example? view answer
- Dependency In Java view answer
- Is Singleton class is serialized ?
view answer
- What is Singleton ? view answer
- What is Observer pattern ? Explain with Code Example ? view answer
- What is Factory Method pattern? view answer
- What is Adapter pattern ? view answer
- What is Proxy and Decorator patterns ? With Java Example ? view answer
- Brief Introduction to OOP Concepts view answer
- What is Abstract Factory Pattern ? With Code Example ? view answer
|
!!! OOPs and Design Pattern interview questions !!!
"is-a" relationship describes inheritance relationship between objects
"is-a" relationship describes inheritance relationship between objects. If you can talk something with word "is". They can be described with keyword extends in coding. "is-a" relationship is also called classification.
public class Pepperoni extends Pizza {//is-a relationship
private int size;//has a relationship
private String style;
public int getSize() {
return size;
}
public void setSize(int sz) {
this.size = sz;
}
public String getStyle() {
return style;
}
public void setStyle(String style) {
this.style = style;
}
}
Note that is-a relationship described with Java code by using extends keyword
|