Today's Jobs :


JAVA DESIGN PATTERNS FREQUENTLY ASKED QUESTIONS AND ANSWERS


JAVA DESIGN PATTERNS FREQUENTLY ASKED QUESTIONS AND ANSWERS


DESIGN PATTERN

Question: Describe the visitor design pattern  
Answer:   Represents an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates. The root of a class hierarchy defines an abstract method to accept a visitor. Subclasses implement this method with visitor.visit(this). The Visitor interface has visit methods for all subclasses of the baseclass in the hierarchy. 

Question: What is a design pattern?  
Answer:   A design pattern systematically names, motivates, and explains a general design that addresses a recurring design problem. 

Question: Describe the visitor design pattern  
Answer:   Represents an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.

The root of a class hierarchy defines an abstract method to accept a visitor. Subclasses implement this method with visitor.visit(this). The Visitor interface has visit methods for all subclasses of the baseclass in the hierarchy.