I am a bit new to Java. I recently tried to chain method calls together but the IDE continues to prompt errors. Here is a sample.

```
int motoYear = (int) modelYear.get("yearsRange").get(0);

```

*modelYear* is type JSONObject. The first .get() returns a JSONObject, and the second .get() returns a JSONArray and the final value is an int (if this was to work as intented). 

The second .get() shows an error "Cannot resolve method 'get(int)'" in the IDE. Is there a slick what to typecast the expected returns of the individual .get() without assigning the values to variables one-by-one? Is something like this possible? I am currently using Android Studio IDE.