The API mentions that remove() method can throw UnsupportedOperationException is the List doesn't support remove. And Arrays.asList according to the documentation: "Returns a fixed-size list backed by the specified array." and hence these operations would not be supported on the List thus obtained

Mohamed Sanaulla wrote:The API mentions that remove() method can throw UnsupportedOperationException is the List doesn't support remove. An Arrays.asList according to the documentation: "Returns a fixed-size list

Ah, I remember the good old days when we would simply respond, "RTFM."

You were lucky this time--somebody knew what the problem was and was able to answer easily. In general though, you'll get better help if you TellTheDetails(⇐click). In this case, pasting in the exact, complete error message and indicating clearly which line caused it.

You were lucky this time--somebody knew what the problem was and was able to answer easily. In general though, you'll get better help if you TellTheDetails(⇐click). In this case, pasting in the exact, complete error message and indicating clearly which line caused it.

Exactly and I did run this program to find out what the runtime exception was and then referred the API for details and to see if there's anything mentioned there.