Skip to content

Category: Java

Feature image for Java related posts.

How to ignore a field while deserializing in Java if its type is not wrong?

public class UserAccount implements HasMoney {
    @JsonIgnore
    private BigDecimal money;

    // Other variable declarations, constructors

    @Override
    @JsonProperty
    public BigDecimal getMoney() {
        return money;
    }

    @JsonIgnore
    @Override
    public void setMoney(final BigDecimal money) {
        this.money = money;
    }

    // Other getters/setters
}

Feature image for Java related posts.

Join strings using StringJoiner in Java

StringJoiner is used to construct a sequence of characters separated by a delimiter and optionally starting with a supplied prefix and ending with a supplied suffix. Syntax Examples

Feature image for Java related posts.

How to pass arguments into a Spring boot run?

To pass arguments when you are running a Spring Boot application you can simply assign your parameters to -Dspring-boot.run.arguments To retrieve these params and use them in your code, declare […]

Feature image for Java related posts.

Array vs ArrayList in Java

In Java, we have two ways to create an array. Array – Simple fixed sized arrays. We cannot change its size. ArrayList – Is a class of Java Collections framework. It […]

Feature image for Java related posts.

Best way to handle nulls in Java

The Best Feeling at starting stage of my development is seeing the Output without ‘NullpointerException‘, but its very difficult. So handling null values is more important in Coding to get […]

Feature image for Java related posts.

Java String split() Method

In this post we will learn how we can convert a comma-separated String into the arrayList in Java. The split() method that splits the String into array of sub-string based […]

Feature image for Java related posts.

Parse String to JSON in Java

In this tutorial, we will learn how to parse string to JSON using different ways in Java.. JSON stands for Java Script Object Notation, most commonly format used to store […]

Feature image for Java related posts.

String Comparison in Java

In this article, We going to see the different ways to compare strings in Java. String is most commonly using datatype in java. And String comparison is very naturally used […]

Text Blocks in Java 13

Text Blocks is one of the new features introduced in Java 13. Assigning a long string value to an Object has been a headache in Java. Thanks to text blocks, […]

Blocked by CORS policy error – How to fix?

Cross-Origin Resource Sharing (CORS) is a technique that makes use of additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources […]

Convert String to int in Java

The following list shows various ways to convert String to int (Integer) in Java. If your string contains only numbers and if you want to return the number it represents […]