Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
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
Forum:
Java in General
Generics question
Sergey Alaev
Greenhorn
Posts: 7
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
import java.util.ArrayList; import java.util.List; public class Test { public static class A { } public static class B { } public <t_1 extends A, t_2 extends B> t_1 f1(t_2 obj) { return null; } public <t_1 extends A, t_2 extends B> List<t_1> f2(t_2 obj) { t_1 t1 = f1(obj); //OK List<t_1> list = new ArrayList<t_1>(); list.add(f1(obj));//compile error: The method add(t_1) in the type List<t_1> is not applicable for the arguments (Test.A) //why? return list; } }
As said in comments, why does that line do not compile?
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Instanceof.
Failure mode of two reference calls to one thread
Question on Method Overiding
can we add Frames into Frames
any thread that has a reference to another thread can execute any method of that othe
More...