This article explains Java Lambda expressions in Java 8. You can find complete code here.
Posts in "Core Java"
Java Hashmap tutorial
Java HashMap is a HashTable based implementation of Map. This is the reason why the interviewer always asks for the difference between HashMap and HashTable. HashMap is mostly equated to HashTable except below two differences. HashMap is unsynchronized while HashTable is synchronized. HashMap permits null while HashTable doesn’t. Important Property of HashMap DEFAULT_INITIAL_CAPACITY Default Initial… Continue reading
this keyword in Java
What is this this is a keyword in Java. It can be used inside the method or constructor of a class. It(this) works as a reference to the current object, whose method or constructor is being invoked. This keyword can refer to any member of the current object from within an instance method or a constructor.
Order of execution
In this article, we will learn about the order of execution of blocks in Java. Different blocks and their order of execution in Java Class Static Block Init Block(Anonymous Block) Constructor /* * Here we will learn to see how the different part (Ananymous Block, Constructor and Static Block ) of class will behave * and… Continue reading
public static void main (string args[]) Explanation
In Java, JVM (Java Virtual Machine) will always look for a specific method signature to start running an application, and that would be the public static void main (String args[]). The main() method represents the entry point of Java programs, and knowing how to use it correctly is very important. Syntax In the above application… Continue reading
Java Basics:Getting Started with Java
Here we will discuss some basics topics related to Java. Where to download Java. How to install Java. Setting up the Environment Variables. Our First Java Program. How to compile a Java application. How to run a Java Application. In next topic we will discuss about the difference between important terms in Java (JDK vs JRE… Continue reading
jdk vs jre vs jvm
In order to understand JDK vs JRE vs JVM. You need to first understand each and every term. So let’s start by defining JDK (Java Development Kit), JRE (Java Runtime Environment), and JVM (Java Virtual Machine).
Exception Handling – The try-with-resources statement
Generally finally block is used to close all the resources (viz., file, database connection, socket or anything that should be closed after its task is done) to prevent any leaks. Sample code: public class ResourceMgt { public static void main(String[] args) { BufferedReader br = null; try { br = new BufferedReader(new FileReader("C://test.txt")); System.out.println(br.readLine()); }… Continue reading
Exception Handling – try catch Java blocks
As developers, we deal with risky situations on a daily basis. Server goes down, or there isn’t enough space to allocate objects on the heap or file is not present in the given location and so on. So every time we decide to do a risky action, we have to inform the compiler that we… Continue reading
Java Thread Tutorial
Thread term can be used in two ways An instance of class java.lang.Thread A Thread of Execution