Skip to main content

Posts

Maven based Interview Question

1. What is Maven?          Maven is a software project management tool. It is open source software from Apache software foundation. It is used for building, reporting and documenting a Software project. It is mainly based on POM (Project Object Model). 2. What are the main features of Maven?           Some of the main features of Maven are: Simple : Maven provides simple project setup that is based on best practices. Fast : You can get a new project or module started in a few seconds in Maven. Easy to learn : Maven usage and commands are easy to learn across all projects. Therefore ramp up time for new developers coming onto a project is very less. Dependency management : Maven provides superior dependency management including automatic updates and transitive dependencies. Multiple Projects : You can easily work with multiple projects at the same time by using Maven. Large Library : Maven has a large and growing repository of libraries and metadata to use out of the box

Java Design Patterns Interview Questions part - 2

Java Design Patterns 1.What are the examples of  Interpreter design pattern in JDK?                          Interpreter design pattern is used to evaluate sentences in a language. E.g. In SQL we can use it to evaluate a query by evaluating each keyword like SELECT, FROM, WHERE clause. In an Interpreter implementation there is a class for each keyword/symbol. A sentence is just a composite of these keywords. But the sentence is represented by Syntax tree that can be  interpreted.  In JDK there are many places where Interpreter design pattern is used. Some of these are as follows: java.util.Pattern java.text.Normalizer Subclasses of java.text.Format: DateFormat, MessageFormat, NumberFormat Subclasses of javax.el.ELResolver: ArrayELResolver, MapELResolver, CompositeELResolver etc. 2. What are the examples of Mediator design pattern in JDK?                           By using Mediator pattern we can decouple the multiple objects that interact with each other. With a Mediato

Java Design Patterns Interview Questions

Java Design Patterns Interview Questions 1. When will you use Strategy Design Pattern in Java? Strategy pattern is very useful for implementing a family of algorithms. It is a behavioral design pattern. With Strategy pattern we can select the algorithm at runtime. We can use it to select the sorting strategy for data. We can use it to save files in different formats like- .txt, .csv, .jpg etc. In Strategy pattern we create an abstraction, which is an interface through which clients interact with our system. Behind the abstraction we create multiple implementation of same interface with different algorithms. For a client, at runtime we can vary the algorithm based on the type of request we have received. So we use Strategy pattern to hide the algorithm implementation details from client. In Java Collections.sort() method uses strategy design pattern. 2. What is Observer design pattern? In Observer design pattern, there is a Subject that maintains the list of Obser