Java program to get the current year, previous year, and next year is described in this post. Here the year’s examples are given based on legacy APIs and JDK 8 APIs Print Current Year In the Legacy way to just print the current year user Calendar instance like Calendar.getInstance().get(Calendar.YEAR) In JDK 1.8 we have new
Java
Java multiple ways to get current time and date
In Java, there are multiple ways to get the current time and date. Numerous choices are available with a range of APIs to print the current time and date. There are legacy APIs and Since Java 1.8 we have more options to print current time and date. Legacy APIs Legacy APIs to print current time
Print Uppercase and Lowercase Alphabets in Java
This post describes how to print alphabets in java using the loop. The alphabet can be printed in lowercase and uppercase. i.e., A to Z or a to z. Print Uppercase Alphabets A to Z using for loop Here for loop is used to print alphabets. Explanation of Program Declare a character using the java
How to Create a Thread in Java Using Lambda Expressions
Lambda Expressions added in Java 8 help us to write functional programming. Here we are going to create a Thread using a Runnable Interface. From Java 8, a Runnable interface is called as a Functional Interface and has only one abstract method named run() Using Lambda Expressions we can directly write the implementation for the
Java 8 noneMatch() vs filter() methods difference and using them together
The filter() and noneMatch() operations are provided by Java 8 Stream API. In this post, we will see the difference between noneMatch and filter operations and how to use them together. Both filter and noneMatch methods serve different purposes. A filter is an intermediate operation whereas noneMatch is a short circuiting terminal operation. noneMatch syntax