
Java
Java 高级编程
KnightHacker2077
CSNOOB
展开
-
Java Collection: PriorityQueue
Extends AbstractQueue and implements the Queue interface Prioritized by the queue's comparator Dynamic: can growclass PriorityQueue<E>ConstructorsCan accept custom constructors Otherwise use default constructor -- sort the queue in asce.原创 2021-12-31 15:25:35 · 376 阅读 · 0 评论 -
Java Comparator
Compare()int compare(T obj1, T obj2)Compare obj1 to obj2 (obj1 -obj2) Returns zero if obj1 =obj2 Returns positive if obj1 >obj2 Returns negative if obj1 <obj2 ClassCastException if the types of the objects are not compatibl...原创 2021-12-30 09:16:33 · 471 阅读 · 0 评论 -
Java: Memory
Garbage CollectionIn Java, the memory created on the heap is released by the garbage collector. When no references to an object exist, that object is assumed to be no longer needed, and the memory occupied by the object can be reclaimed. There is no exp原创 2021-10-31 07:00:29 · 256 阅读 · 0 评论 -
Java Polymorphism
Many classes that are related to each other by inheritance.Each subclass inherit attributes and methods from superclass Subclasses also implement the methods in their own wayExamplepublic interface Vegetarian{}public class Animal{}public class .原创 2021-10-31 06:24:36 · 113 阅读 · 0 评论 -
Java Static
Static Class VariableIf a variable X of a class C is flagged as static, there will be only one copy of X no matter how many instances of C are created. Like a global variable.Static variableexists from the start of the execution of the program, befor.原创 2021-10-21 00:42:56 · 122 阅读 · 0 评论