• Multiple classes in one file in Java
    18 October

    Multiple classes in one file in Java

    In this post, we will see how to have multiple classes in one file in java. Introduction You need to have any number of classes in a single Java file, but there is a restriction that you can declare only one Java class as public modifier with the main() method and declare (without public) for […]

  • 16 October

    Java AES Encryption Decryption Example

    Introduction AES stands for advanced encryption standard and is the most commonly used symmetric algorithm to encrypt sensitive data and can be used in both software and hardware. The AES algorithm is symmetric, meaning that it uses only one key for encryption and decryption, and due to this reason, the key must be shared between […]

  • 11 September

    RSA Encryption and Decryption in Java

    Introduction RSA is a short form for Rivest, Shamir, and Adleman, are the people who first publicly described it in 1977. It is an algorithm for asymmetric cryptography which involves the use of two keys. A public key, which can be known to anybody and can be used to encrypt messages, and verify signatures. A […]

  • 10 September

    How to remove element from Arraylist in java while iterating

    Introduction In this tutorial, you will learn how to remove element from Arraylist in java while iterating using different implementations provided by Java. It is necessary to understand the right way to remove items from a List because we might encounter errors in our programs if not done correctly. For example, If we try to […]

  • Find duplicate elements in the Stream
    17 October

    Java 8 – Find duplicate elements in Stream

    Introduction When working with a collection of elements in Java, it is very common to have duplicate elements, and Java provides different APIs that we can use to solve the problem. Java 8 Stream provides the functionality to perform aggregate operations on a collection, and one of the operations includes finding duplicate elements. In this […]

  • 17 October

    Java AES 256 Encryption Decryption Example

    Introduction Advanced encryption standard (AES) is the most secure encryption standard compared to RSA, which is vulnerable to brute force attacks. This is the main reason that AES was established by the National Institute of Standard and Technology (NIST) in 2001 and is used worldwide to date. In the previous post, we have seen how […]

  • Get current year in java
    13 July

    Get current year in Java

    In this post, we will see how to get current year in Java. Using Date and SimpleDateFormat The Date class was introduced in Java 1.0 and provided different approaches to work with time. The SimpleDateFormat inherits from DateFormat and is mainly used to parse a date to text. You can provide your custom pattern to […]

  • 13 July

    Remove substring from String in Java

    In this post, we will see how to remove substring from String in java. There are multiple ways to remove substring from String in java. Using String’s replace method to remove substring from String in Java This method belongs to the Java String class and is overloaded to provide two different implementations of the same […]

  • Break out of nested loop in java
    22 July

    How to break out of nested loops in Java

    In this post, we will see how to break out of nested loops in Java. Using break (will break inner loop) It is very important to understand how nested loops work to ensure that applying break will output the desired result. If you are a novice with nested loops, I am going to make the […]