Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface ILeft {}
- interface IRight {}
- class BaseClass implements ILeft {}
- class WillieClass extends BaseClass implements IRight {}
- class WonkaClass extends BaseClass implements IRight {}
- public class TCall
- {
- <T extends ILeft & IRight> void foo(T t) {}
- void bar()
- {
- foo(new WillieClass());
- foo(new WonkaClass());
- }
- void quux(Object o)
- {
- if (o instanceof IRight && o instanceof ILeft)
- foo(o); // Can this compile?
- }
- }
Add Comment
Please, Sign In to add comment