you should declare your first val same as the second one with object : … .
in the first declaration you simply create a new instance of JsonObjectRequest whereas in the second delcaration you define an instance of a class which inherits from StringRequest which in turn can override any open method in its parent class.
1 Like