Monday, November 24, 2008

Generics and Wildcards.

1.What will be the output of This program?

public class ArrayToCollection {
   public static void main(String s[]){
       int a[]=new int[10];
       for(int i=0;i<10;i++){
         a[i]=i;
       }

       for(Integer i:a){
         System.out.print(" "+i);
       }
   }
}
Answer :0 1 2 3 4 5 6 7 8 9

2.

No comments: