• 25 October

    Create Array from 1 to n in Java

    Introduction In this article, we will look at How to Create an Array from 1 to n in Java. We need to Initialize Arrays in a sequence of values ranging from 1 to number N. Knowing how we can initialize arrays in different ways will give us deeper insights into Array in Java and allow […]

  • 25 October

    [Fixed] Unsupported Class File Major Version 61 in Java

    1. Introduction Java developers often face the challenge of compatibility issues, such as the unsupported class file major version 61" error. This problem arises when a Java program, compiled with Java 17 (denoted by major version 61), is run on a Java version that’s older than Java 17. This guide is crafted to be beginner-friendly […]

  • 05 October

    Find Difference Between Two Instant in Java

    In this post, we will see how to find difference between two Instant in Java. Ways to find difference between two Instant in Java There are multiple ways to find difference between two Instant in various time units such as Days, Hours, Minutes, Seconds etc. Using Instant’s until() method To find difference between two Instant, […]

  • 05 October

    Find Difference Between Two LocalDateTime in Java

    In this post, we will see how to find difference between two LocalDateTime in Java. Ways to find difference between two LocalDateTime in Java There are multiple ways to find difference between two LocalDateTime in various time units such as Days, Months, Years etc. Using LocalDateTime’s until() method We can use LocalDateTime’s until() method to […]

  • 05 October

    Find Difference Between Two LocalDate in Java

    In this post, we will see how to find difference between two LocalDate in Java. Ways to find difference between two LocalDate in Java There are multiple ways to find difference between two LocalDate in various time units such as Days, Months, Years etc. Using LocalDate’s until() method We can use LocalDate’s until() method to […]

  • 27 September

    Repeat String N times in Java

    Introduction In this article, we will learn how to Repeat a given String N times in Java . This is a trick question common in JAVA interviews and the candidate’s evaluation is based on different approaches he/she provides for the problem. So we will take a deep dive into looking at various ways to solve […]

  • 26 September

    Get List of Weekday Names in Java

    In this post, we will see how to get list of weekday names in Java. Using DateFormatSymbols’s getWeekdays() method We can use DateFormatSymbols's getWeekdays() to get list of weekday names in Java. It will provide complete weekday names like Sunday, Monday etc. [crayon-68cbbe8216c65941766571/] Output [crayon-68cbbe8216c6c193164498/] Using DateFormatSymbols’s getShortWeekdays() method [For short names] If you need […]

  • 24 September

    Display Negative Number in Parentheses in Java

    In this post, we will see how to display negative number in Parentheses in Java. We can use pattern #,##0.00;(#,##0.00) with DecimalFormat‘s format() to display negative number in Parenthesis in Java. [crayon-68cbbe8216d95292532917/] Output [crayon-68cbbe8216d98689461623/] If you don’t need decimal places, you can change to pattern to: [crayon-68cbbe8216d99170587183/] Let’s understand meaning of pattern #,##0.00;(#,##0.00): First part […]

  • 24 September

    Increment for Loop by 2 in Java

    In this post, we will see how to increment for loop by 2 in Java. There are several looping statements available in Java and one of them is for loop in java. There are three parts of for loop. Initialization Condition Increment or decrement [crayon-68cbbe8216e68028212619/] Initialization: Initialization statement executes at start of loop only one […]