JavaTXCompilerInJavaTX/resources/javFiles/Generics.jav

22 lines
393 B
Plaintext
Raw Permalink Normal View History

2018-05-07 10:51:29 +00:00
import java.lang.String;
2017-03-22 15:05:59 +00:00
class Generics<B> {
//<A extends B> A mt1(A a, B b){
B mt1(B a, B b){
2017-03-22 15:05:59 +00:00
return mt1(a, a);
}
}
class Test {
methode(String s){
return new Generics<String>().mt1(s,s);
}
}
/*
Problem:
auto test = new List<String>();
auto test2 = new List<Integer>();
... //code, welcher möglicherweise test und test2 vertauscht
test.add("hallo");
*/