11.15

作者: Dandelion637 | 来源:发表于2018-04-01 00:45 被阅读13次

    import java.util.*;class ExtendsObject extends Object {}public class Main {public static void main(String[] args) {Queuequeue = new PriorityQueue();

    queue.offer(new ExtendsObject());

    queue.offer(new ExtendsObject());

    }

    } /* Output:

    Exception in thread "main" java.lang.ClassCastException: ExtendsObject cannot be cast to java.lang.Comparable

    at java.util.PriorityQueue.siftUpComparable(Unknown Source)

    at java.util.PriorityQueue.siftUp(Unknown Source)

    at java.util.PriorityQueue.offer(Unknown Source)

    at Main.main(Main.java:10)

    *///:~

    相关文章

      网友评论

          本文标题:11.15

          本文链接:https://www.haomeiwen.com/subject/zghncftx.html