title: How to understand this snippet of Kotlin code?
body: <p>I come from Java and I'm following a tutorial online regarding using the <code>Volley</code> library to make web requests in Android. </p>
  
  <p>The instructor created the request variable like this:</p>
  
  <pre><code>val registerRequest = object : StringRequest(Method.POST, URL_REGISTER, Response.Listener {
              println(it) // will print the response
              complete(true)
          }, Response.ErrorListener {
              Log.d("ERROR", "Could not register user: $it")
              complete(false)
          }) {
              override fun getBodyContentType(): String {
                  return "application/json; charset=utf-8"
              }
  
              override fun getBody(): ByteArray {
                  return requestBody.toByteArray()
              }
          }
  </code></pre>
  
  <p>I understand that he's creating a <code>registerRequest</code> variable of type <code>StringRequest</code>. But what I don't understand is why he prefixed <code>StringRequest</code> with <code>object :</code> here. </p>
  
  <p>Also I understand that <code>StringRequest</code> constructor takes in an <code>Int, String, Lambda, Lambda</code>. After that it becomes confusing to me because the developer was able to declare some <code>override</code> methods after the constructor closes. Why did they do this? From what I can tell, this is similar to subclassing StringRequest, then writing the override methods there? Am I right?  </p>
  
  <p>Coming from Java, this way of writing code is quite unusual to me.</p>