• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Output???

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.");
}
}
}
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm sorry, but is there a question here somewhere?
 
Shilpa Pisipati
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course Fred......You need to give output of this code.........
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Shilpa Pisipati:
Of course Fred......You need to give output of this code.........



Considering that Fred doesn't have the code -- especially the parts that has the setFavorite and getFavorite methods -- wouldn't it be easier for you to just run it yourself?


BTW, asking for the output is not a question which you will get a lot of answers, since it shows that you are not showing much effort. A better question is showing the output yourself, explain why you think it is wrong, and asking why?

Henry
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Q: Output???

A: Not without compilation.
 
You don't know me, but I've been looking all over the world for. Thanks to the help from this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic