D esign patterns are programming language independent strategies for solving the common object-oriented design problems. That means a design pattern represents an idea, not a particular implementation. By using the design patterns you can make your code more flexible, reusable, and maintainable. It is the most important part because java internally follows design patterns. Categorization of design patterns: Basically, design patterns are categorized into two parts: Core Java (or JSE) Design Patterns. JEE Design Patterns. Core Java Design Patterns In core java, there are mainly three types of design patterns, which are further divided into their sub-parts: 1.Creational Design Pattern Factory Pattern Abstract Factory Pattern Singleton Pattern Prototype Pattern Builder Pattern. 2. Structural Design Pattern Adapter Pattern Bridge Pattern Composite Pattern Decorator Pattern Facade Pattern Flyweight Pattern Proxy Pattern 3. Behavioral Design Pattern Chain Of Responsibility Pattern Command Pa...
Java 8 new features 1. Lambda Expressions A lambda expression is an anonymous function. A function that doesn’t have a name and doesn’t belong to any class. so compiler does not create .class file. Used to provide the implementation of an interface which has functional interface //Syntax of lambda expression ( parameter_list ) -> { function_body } Example: Creating Thread with Lambda package com.vasanth.java8; public class ThreadWithLambda { public static void main (String args[]){ //Traditional approach Runnable r1= new Runnable() { @Override public void run() { System. out .println( "Thread 1 started" ); } }; Thread t1= new Thread(r1); t1.start(); //With Lambda Runnabl...
Comments
Post a Comment