Skip to main content

Posts

Showing posts from May, 2020

Lambda Expression in Java 8 with examples | Programming Blog

What is Lambda Expression in Java 8? In java, Lambda expression are introduced in java 8. Lambda is first step for Functional Programming. Lambda expression is just anonymous function or we can say nameless function.   Java lambda expression are used to implement simple callback, event listener or functional programming with java stream API. Lambda expression is really helpful in collection library. It helps filter, iterate and get data from collection. Lambda expression is provide implementation of an interface which has Functional interface. Lambda expression is treated as function in java.   We can say it is Lambda expression if function follows following condition :- Function does not have name Function does not have return type Function does not have modifiers Why we need Lambda Expression in Java? -> To enable Functional programming we need Lambda expression in Java.    So, why we must use lambda expression. because of simple following advantage. Less code compare than simple

ABSTRACTION IN JAVA

What is Abstraction in Java?   In this blog, we show what is abstract in java. so lets start from  What Is Abstraction in java? Abstraction is process that hide implementation details and show only functionality to users. In another words, It shows only essential things to user and hide the internal details. Like, you search on google and find your content but what happen internally you does not care. So we learn about Abstract class and Method in Java. Abstract Class In Java Abstract class means that are declared with abstract keyword before class.  So if we declare abstract keyword in class then we does not instantiate that class. means we can not create of abstract class... So you asked then how we use abstract classes member data? We can create subclass from abstract class and create object of subclass to access abstract class member data. abstract class AbstractDemo {      // Class members } So before jump into coding lets see key point of abstract Abstract class must be declare

IIFE in JavaScript

What is IIFE in JavaScript? | JavaScript IIFE with example   An IIFE  means Immediately Invoked Function Expression.  IIFE is a JavaSc tript function that  runs as soon as it is defined. I know it is difficult to understand but i describe in simplicity so lets start. So this is normal function in JavaScript that we used in our daily life. // Normal function in JavaScript function addTwoValues() { var a = 10; var b = 10;   var answer = x + y;      console.log(answer); } addTogether(); So here is function addTwoValues() which is add two values and print the output. I called that function after in last where function ends. So, there might be question in your mind yes we use like this what is problem in that. In above example our variables are immutable which means we can not change from outside of function. So our variables are not accessed, but what about function that can be accessed from anywhere. So we have solution for that it calls  IIFE. It is a desi