Kevin
Kevin

Reputation: 61

Why can't I successfully call the .put method here?

I made a JSONArray object but can't seem to call the .put method on it. Does anyone know why?

Code screenshot

Upvotes: 0

Views: 745

Answers (1)

lealceldeiro
lealceldeiro

Reputation: 14988

It should be prevjobs.add("name"); since JSONArray extends ArrayList, and that's how items are added to an ArrayList.

Also, check the unofficial javadocs, section Methods inherited from class java.util.ArrayList.

Finally, if you do Ctrl + Space after prevjobs. you can see the available methods from the JSONArray API.

Upvotes: 2

Related Questions