Dave is correct. If you have only a theory question, please just Google it. Use StackOverflow only for a practical question that you faced and could not get an answer of from google. AI tools also made it easier to search for such theory answers.
Also, please remove the spring-boot tag here.
For your Question,
Records in Java were introduced in the Java 14 version, which simply saves efforts on making your class Immutable. Records eliminate boilerplate code like constructors, getters
, setters
, hashCode()
, equals()
, and toString()
methods that you typically write for simple data-carrier classes.