Output??

Discussion in 'Java' started by gouri.83, Dec 3, 2007.

  1. gouri.83

    gouri.83 New Member

    Joined:
    Dec 3, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    public class TypeSafeHetrogenousExample {
    
    
           public static void main(String[] args) {
    
    
                   List<String> stooges = Arrays.asList("Larry", "Moe",
    "Curly");
                   List<Integer> fibs = Arrays.asList(1, 1, 2, 3, 5, 8 );
    
                   f.setFavorite(List<String>.class, Stooges);
                   f.setFavorite(List<Integer>.class, fibs);
    
                   String s = f.getFavorite(List<String>.class);
                   int i = f.getFavorite(List<Integer>.class);
    
                   if(i==0) {
                           System.out.println("expected");
                   }else {
                           System.out.println("not sure.");
                   }
           }
    }
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,376
    Likes Received:
    388
    Trophy Points:
    83
    Submitted as an article and moved to forum for discussion
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice