Database.stateful: We know that, batch apex is stateless by default. it means for each execution of execute method, you receive a fresh copy of your object. And all fields of the class are initialized, static and instance.
It means for each execution of execute method, you receive a fresh copy of your object. And all fields of the class are initialized, static and instance.