Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Output???  RSS feed

 
Shilpa Pisipati
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • 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.");
}
}
}
 
fred rosenberger
lowercase baba
Bartender
Posts: 12541
48
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Of course Fred......You need to give output of this code.........
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • 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
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q: Output???

A: Not without compilation.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!