aspose file tools*
The moose likes Beginning Java and the fly likes genrics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "genrics" Watch "genrics" New topic
Author

genrics

santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
the JVM has no idea that your ArrayList was supposed to hold only
Integers. The typing information does not exist at runtime! All your generic code
is strictly for the compiler. then how come the casting is not reqiured while retrieving the contents...... Ex List<String> list = new ArrayList<String>();
list.add("santhosh");
String name = list.get(0);


Creativity is nothing but Breaking Rules
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 606

1. Create a simple program that uses generics.
2. Compile the program to a class file.
3. Get hold of a decompiler and decopile the class file created in step 2.
4. Look at the source code of the decompiled file.

Try these steps and see if it answers your question

To help you further try compiling and then decompiling this code,



Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: genrics