-
How to Implement Singleton Design Pattern in Java (Step-by-Step)
What is singleton design pattern A Singleton Pattern says that just “define a class that has only one instance and provides a global point of access to it . If singleton class is loaded by two classloaders, two instance of singleton class will be created, one for each classloaders. Key Concepts 1. Significance of Serialization in Singleton Pattern Serialization in Java means converting an object into a byte stream so it can be: Deserialization is the reverse process (byte stream → object). Even if your class ensures only one instance, deserialization creates a NEW object, which violates the Singleton rule. Example: Singleton Class (Without Protection) 2.TestSingleton.java output false // false…
-
Stream API in Java 8: Complete Guide with Examples
Stream api is a powerful abstraction for processing sequence of elements in a functional and declarative style . it allows developers to perform complex data manipulations such as filtering , mapping , sorting and reducing with minimal boilerplate code . Stream represent a pipeline of operations that can be executed either sequentially or in parallel , improving both readability and performance . Purpose of Stream Api The main goals of the stream api are . 1.Simplify data processing: Replace verbose loops with expressive operations 2.Enable Functional programing : use lambda expressions and method references 3. Improve Performance: Support parallel execution with parallel stream . Pipeline in Java Stream A stream…
-
What is application
An application refers to a program or software designed to perform specific tasks for users. Applications can range from simple tools like calculators to complex systems such as enterprise resource management platforms. Types of Applications To develop distributed application we use a language called java and java comes under internet software. Architecture required for development of distributed application , programmer must use a well known Architecture known as client server architecture . 2-Tier Architecture Two tier Architecture it contains client and server side programing . 3-Tier Architecture Three tier architecture it contains client , server program and database software n-Tier Architecture n tire architecture it contains client program , fire wall program(security…