Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Java/J2EE Design Patterns Interview Questions You'll Most Likely Be Asked: Second Edition
Java/J2EE Design Patterns Interview Questions You'll Most Likely Be Asked: Second Edition
Java/J2EE Design Patterns Interview Questions You'll Most Likely Be Asked: Second Edition
Ebook129 pages1 hour

Java/J2EE Design Patterns Interview Questions You'll Most Likely Be Asked: Second Edition

Rating: 0 out of 5 stars

()

Read preview

About this ebook

  • 225 Java/J2EE Design Patterns Interview Questions
  • 78 HR Interview Questions 
  • Real life scenario-based questions
  • Strategies to respond to interview questions
  • 2 Aptitude Tests

Java/J2EE

LanguageEnglish
Release dateAug 7, 2019
ISBN9781949395310
Java/J2EE Design Patterns Interview Questions You'll Most Likely Be Asked: Second Edition

Read more from Vibrant Publishers

Related to Java/J2EE Design Patterns Interview Questions You'll Most Likely Be Asked

Titles in the series (33)

View More

Related ebooks

Internet & Web For You

View More

Related articles

Reviews for Java/J2EE Design Patterns Interview Questions You'll Most Likely Be Asked

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Java/J2EE Design Patterns Interview Questions You'll Most Likely Be Asked - Vibrant Publishers

    Java/J2EE Design Patterns Interview Questions You'll Most Likely Be Asked:

    Second Edition

    Job Interview Questions Series

    www.vibrantpublishers.com

    *****

    Java/J2EE Design Patterns Interview Questions You'll Most Likely Be Asked: Second Edition

    Copyright 2021, By Vibrant Publishers, USA. All rights reserved. No part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior permission of the publisher.

    This publication is designed to provide accurate and authoritative information in regard to the subject matter covered. The author has made every effort in the preparation of this book to ensure the accuracy of the information. However, information in this book is sold without warranty either expressed or implied. The Author or the Publisher will not be liable for any damages caused or alleged to be caused either directly or indirectly by this book.

    Vibrant Publishers books are available at special quantity discount for sales promotions, or for use in corporate training programs. For more information please write to bulkorders@vibrantpublishers.com

    Please email feedback / corrections (technical, grammatical or spelling) to spellerrors@vibrantpublishers.com

    To access the complete catalogue of Vibrant Publishers, visit www.vibrantpublishers.com

    *****

    Table of Contents

    1. Introduction to Design

    2. Methods and Classes

    3. Methods and Objects

    4. Patterns and Objects

    5. Commands

    6. Proxies

    7. Presentation, Business and Integration

    8. Miscellaneous

    HR Interview Questions

    INDEX

    *****

    Dear Reader,

    Thank you for purchasing Java/J2EE Design Patterns Interview Questions You'll Most Likely Be Asked: Second Edition. We are committed to publishing books that are content-rich, concise and approachable enabling more readers to read and make the fullest use of them. We hope this book provides the most enriching learning experience as you prepare for your interview.

    Should you have any questions or suggestions, feel free to email us at reachus@vibrantpublishers.com

    Thanks again for your purchase. Good luck with your interview!

    – Vibrant Publishers Team

    *****

    Java/J2EE Design Patterns Interview Questions

    Review these typical interview questions and think about how you would answer them. Read the answers listed; you will find best possible answers along with strategies and suggestions.

    *****

    Introduction to Design

    1: Give some examples of design patterns used within JDK.

    Answer:

    a) Adapter pattern - This is useful to convert one type of object to another type of object. So basically, you can make an incompatible object, compatible with another class. A good example of this is the Arrays.asList method. This method in the java.util.Arrays class is used to convert an array into a java.util.List.

    b) Decorator Pattern - This is used to add additional behavior to an object. The Collections.synchronisedList is an example. It accepts a List object and returns a synchronised version of the List. So, it adds the additional functionality of synchronising the List. Similarly, the Collections unmodifiable Map is an example since it accepts a Map object and returns a Map which is read-only.

    c) Builder pattern - This is used to move the object creation into a separate process. This helps to construct complex objects via easy steps. Not only that, once you define the creation process, you can use this to build different objects. The StringBuilder.append method is an example of the builder pattern since it allows you to build a StringBuilder object using various data types like int, long etc. Also, if you change the parameter passed to this object, you will get a different object.

    2: What are the types of Java Design Patterns? Explain each one in detail.

    Answer:

    There are three types of design patterns supported by Java. They are as follows:

    a) Creational - These design patterns provide different ways of creating an object of a class without using the new operator. Some examples are Factory method, Prototype, Singleton, etc.

    b) Behavioral - These design patterns control how objects communicate with each other and assign responsibility to objects. Some examples are Chain of Responsibility, Iterator, Mediator, etc.

    c) Structural - These design patterns help to change the structure of an object or convert the object into a different form. Example Adapter, Decorator, Proxy, etc.

    3: What are the types of J2EE Design Patterns? Give some examples of each.

    Answer:

    J2EE Design Patterns can be classified based on the tier on which they operate that is Design patterns for Presentation Tier, Business Tier and Integration tier. Some examples of each are as follows:

    a) Presentation Tier – Front Controller Design Pattern, View Helper Design pattern, Intercepting Filter Design Pattern, Context Object Design Pattern, etc.

    b) Business Tier - Business Delegate Design Pattern, Data Transfer Object Design Pattern, Service Locator Design Pattern, Value List Handler Design Pattern, etc.

    c) Integration Tier - Data Access Object Pattern and Service Activator Pattern.

    4: Name some J2EE technologies that use various design patterns.

    Answer:

    a) Spring's Dispatcher Servlet uses the FrontController design pattern. In this design pattern, there is a single centralized controller that receives client requests, does some pre-processing and then hands over the request to the actual services. In a Spring MVC application, the Dispatcher Servlet is configured in web.xml and all incoming URLs are mapped to it. The Dispatcher Servlet then passes the request to the appropriate controller.

    b) Apache Tiles framework makes use of the Composite View design pattern. In this design pattern, a page is comprised of multiple independent components, so it is easier to update the content in each part of the page without affecting the layout. The Apache Tiles framework allows you to write code as simple fragments which can be then included in pages as desired.

    c) JMS uses the Service Activator pattern. This design pattern makes asynchronous communication between a client and a server application possible, so the client application does not have to wait even if there is a long running process on the server side. In a JMS application, there is a JMS Provider that provides services asynchronously to client applications.

    5: What are Design Patterns?

    Answer:

    Design Patterns as the name suggests are the series of patterns which can be applied to software problems which are of repeating nature. These Design patterns offer probable solutions to these problems through the use of classes and methods in an object-oriented programming environment. The Design Patterns have been designed and tested by experienced engineers over the years and serve as a template to solve the problems encountered in software engineering.

    6: What is a Class Interface in Design Patterns?

    Answer:

    A Class Interface represents the collection of Methods and fields of a class that allow objects of other classes to access.

    7: What is a Class Implementation in Design Patterns?

    Answer:

    A Class Implementation is designed to be the code that lies within its own code, with instructions on how an object is to fulfill a certain commitment.

    8: What is the Java Interface Construct?

    Answer:

    The Java Interface Construct is a tool, powerful in its own right, used for adaptation of class interfaces and for applying patterns to collection of classes.

    9: What

    Enjoying the preview?
    Page 1 of 1