I want to make a pojo class in which I am binding a json object using ObjectMapper. I have to use a variable name
private String package;
but the above line showing me error. Is there any solution so that I can use this variable name package.
I want to make a pojo class in which I am binding a json object using ObjectMapper. I have to use a variable name
private String package;
but the above line showing me error. Is there any solution so that I can use this variable name package.
as said in previous comment, package cannot be used in java as a variable name but you can annotate the variable to still use that name in JSON
@JsonProperty("package")
private String packageName
Reserved words are words that can not be used as names of objects or variables in a Java program because they are already used by the syntax of the Java programming language.
Package is also a Reserved word.
If you try to use any of the following words as identifiers in your Java programs, you will get an error.