0

I want to define relationship between two type parameters in Java and I know using wildcard would be a better option,still wanted to use two type parameters with super relationship.But i am not able to do so. Can anyone suggest me where I am going wrong(It gives compiler error "super"expected)

 public static <T,S super T> T writeAll(Collection<T> coll, Class<S> snk) {

            return null;

        }

      public static <T,S> T writeAllTwo(Collection<T> coll, Class<S super T> snk) {

            return null;

        }
Kumar Abhinav
  • 6,565
  • 2
  • 24
  • 35

0 Answers0