aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes generics 1.4 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "generics 1.4 " Watch "generics 1.4 " New topic

generics 1.4

rohit kumar

Joined: May 27, 2007
Posts: 9

I am getting a runtime error. PLs help
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
When you create a List using asList, the size is fixed.
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
That's because the list is backed by the array, and arrays can't change their size.

But you could make a copy of the list returned by the asList method using
List ints = new ArrayList(
Arrays.asList(new Integer[] {new Integer(1), new Integer(2), new Integer(3)})

Then you'll have your six and ten.

By the way, wouldn't be "The Six and Ten" a nice name for a pub?

all events occur in real time
Have you tried LearnNowOnline?
subject: generics 1.4