Java collection Type mismatch: cannot convert from TreeSet to SortedSet

Sanchit Garg
package collection;

import java.util.*;

public class SortedSet {

    public static void main(String[] args) {
        // TODO Auto-generated method stub

         SortedSet set = new TreeSet();

    }

}

It giving me following error:

Type mismatch: cannot convert from TreeSet to SortedSet
Eran

Your class name is also SortedSet, so it is hiding java.util.SortedSet. Either rename your class (the preferred option) or use the full name of the interface in your variable declaration.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Java - Type mismatch: cannot convert from element type Object to String

From Dev

Java - Type mismatch: cannot convert from element type Object to String

From Dev

Type mismatch: cannot convert from java.lang.String to String

From Dev

Java generics. Type mismatch: cannot convert from object to

From Dev

Java generics : Type mismatch: cannot convert from Integer to K

From Dev

Java generics. Type mismatch: cannot convert from object to

From Dev

Type mismatch: cannot convert from boolean to int

From Dev

Type mismatch: cannot convert from ListFragment to Fragment

From Dev

Type mismatch: cannot convert from long to int

From Dev

type mismatch: cannot convert from double to Double

From Dev

Type mismatch cannot convert from String to String[]

From Dev

Type mismatch: cannot convert from Scanner to boolean

From Dev

Type mismatch: cannot convert from void to Integer

From Dev

Type mismatch: cannot convert from int to TextView

From Dev

Type mismatch: cannot convert from void to int

From Dev

Type mismatch : cannot convert from double[][] to double[]

From Dev

Type mismatch: cannot convert from boolean to double

From Dev

Type mismatch cannot convert from String to String[]

From Dev

Type mismatch: cannot convert from double to double[]

From Dev

Type mismatch: cannot convert from void to Thread

From Dev

Type mismatch: cannot convert from java.util.Date to java.sql.Date

From Dev

Type Type mismatch: cannot convert from RegisterFragment to Fragment

From Dev

Type mismatch: cannot convert from element type Object to Cookie

From Dev

type mismatch cannot convert from element type object to string

From Dev

type mismatch cannot convert from element type object to string

From Dev

Type mismatch: cannot convert from element type Object to Cookie

From Dev

Type mismatch: cannot convert from element type Object to List

From Dev

Java type mismatch, cannot convert to return itself as the generic type

From Dev

issue with java 8 collectors Type mismatch: cannot convert from List<Object> to List<String>

Related Related

  1. 1

    Java - Type mismatch: cannot convert from element type Object to String

  2. 2

    Java - Type mismatch: cannot convert from element type Object to String

  3. 3

    Type mismatch: cannot convert from java.lang.String to String

  4. 4

    Java generics. Type mismatch: cannot convert from object to

  5. 5

    Java generics : Type mismatch: cannot convert from Integer to K

  6. 6

    Java generics. Type mismatch: cannot convert from object to

  7. 7

    Type mismatch: cannot convert from boolean to int

  8. 8

    Type mismatch: cannot convert from ListFragment to Fragment

  9. 9

    Type mismatch: cannot convert from long to int

  10. 10

    type mismatch: cannot convert from double to Double

  11. 11

    Type mismatch cannot convert from String to String[]

  12. 12

    Type mismatch: cannot convert from Scanner to boolean

  13. 13

    Type mismatch: cannot convert from void to Integer

  14. 14

    Type mismatch: cannot convert from int to TextView

  15. 15

    Type mismatch: cannot convert from void to int

  16. 16

    Type mismatch : cannot convert from double[][] to double[]

  17. 17

    Type mismatch: cannot convert from boolean to double

  18. 18

    Type mismatch cannot convert from String to String[]

  19. 19

    Type mismatch: cannot convert from double to double[]

  20. 20

    Type mismatch: cannot convert from void to Thread

  21. 21

    Type mismatch: cannot convert from java.util.Date to java.sql.Date

  22. 22

    Type Type mismatch: cannot convert from RegisterFragment to Fragment

  23. 23

    Type mismatch: cannot convert from element type Object to Cookie

  24. 24

    type mismatch cannot convert from element type object to string

  25. 25

    type mismatch cannot convert from element type object to string

  26. 26

    Type mismatch: cannot convert from element type Object to Cookie

  27. 27

    Type mismatch: cannot convert from element type Object to List

  28. 28

    Java type mismatch, cannot convert to return itself as the generic type

  29. 29

    issue with java 8 collectors Type mismatch: cannot convert from List<Object> to List<String>

HotTag

Archive