1. Java Generics? ?? ??
Java Generics? ???? ?? ????? ???? ???, ????? ? ???? ??? ? ????. ?? ??? ??? ?? ???? ????? ??? ??? ??? ???? ??? ??? ? ??? ?????.
1.1 ????? ??????
???? ???? ??? ??? ?? ?? ???? ???? ???, ????? ?? ???? ??? ? ??? Java 5? ??? ?????. ?? ??? ?? ?? ???? ????? ?? ???? ??? ? ?? ??? ? ???? ???? ? ??? ???.
?:
public class Box<T> { private T value; public void setValue(T value) { this.value = value; } public T getValue() { return value; } }
? ??? T? Box? ????? ??? ? ?? ??? ???? ??? ? ?? ?? ???????.
1.2 ? Generic? ??????
???? ?? ?? ??? ?????.
- ?? ???: ??? ??? ?? ???? ???? ???? ?? ??? ??? ??? ????.
- ?? ????: ??? ??? ??? ??? ? ?? ?? ???? ???? ?? ? ????.
- ??? ??: ???? ???? ?? ???? ???? ???? ??? ? ???? ?? ?? ???? ?????.
?:
??? ??:
List list = new ArrayList(); list.add("Hello"); String s = (String) list.get(0); // Casting needed
??? ??:
List<String> list = new ArrayList<>(); list.add("Hello"); String s = list.get(0); // No casting needed
2. ????? ??? ??
?? ???? ???? ???? ?? ???? ???? ?? ??? ? ????. ??? ???? ???? ????? ???? ??? ??? ????.
2.1 ?? ??? ?
?? ??? ? ?? ???? ?? ??? ?? ??? ???.
public class Pair<K, V> { private K key; private V value; public Pair(K key, V value) { this.key = key; this.value = value; } public K getKey() { return key; } public V getValue() { return value; } }
? ??? K? V? pair? ????? ??? ? ??? ? ?? ?? ???????.
?? ?:
Pair<String, Integer> pair = new Pair<>("Age", 30); System.out.println("Key: " + pair.getKey() + ", Value: " + pair.getValue());
2.2 ??? ?? ????
??? ?? ???? ???? ?? ??? ? ?? ??? ???? ?? ?? ????. ??? ?? ????? ???? ???? ??? ??? ??? ? ????.
?:
public class NumberUtils { public static <T extends Number> void printNumber(T number) { System.out.println("Number: " + number); } }
??? T? Integer, Double ?? ?? Number? ?? ???? ?????.
?? ?:
NumberUtils.printNumber(10); // Valid NumberUtils.printNumber(10.5); // Valid
3. ???? ???
???? ????? ???? ????. ???? ??? ??? ???? ??? ?? ???? ??? ?? ????.
3.1 ???? ??? ?
??? ? ?? ? ? ???? ???? ??????.
public class Util { public static <T extends Comparable<T>> T max(T a, T b) { return a.compareTo(b) > 0 ? a : b; } }
? ???? T? T? ??? ? ??? Comparable? ???? ?? ?? ???????.
?? ?:
public class Box<T> { private T value; public void setValue(T value) { this.value = value; } public T getValue() { return value; } }
3.2 ???? ?????
?????? ???? ???? ??? ??? ?? ???? ??? ? ????. ?? ??, ? ?? T? T? ???? ? ? ?? ??? ????, ? super T? T? ?? ??? ? ? ?? ??? ?????.
?:
List list = new ArrayList(); list.add("Hello"); String s = (String) list.get(0); // Casting needed
?? ?:
List<String> list = new ArrayList<>(); list.add("Hello"); String s = list.get(0); // No casting needed
4. ??
Java Generics? ????? ??? ???? ???? ?? ??? ? ????. ???, ??? ? ??????? ???? ???? ??? ???? ?? ???? ??? ??? ??? ??? ? ????. ??? ??? ?? ??? ??? ?? ??? ??? ?????!
?? ? ?? ???? ?????. Java Generics ?????: ?? ??? ??? ?? ???
? ??? Java Generics ?????: ?? ??? ??? ?? ???? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

??? ??











?? ?? ?? ??? ??? ?? ??? ??, ? ? ?? ? ??? ?????. 1. ??? ?? ???? ?? ???? ???-????, ? ??? ??? ??? ? ????, Hashmap? ???-??? ?? ??? ??? ???? ????. 2. NULL ? ?? ???? HashMap? ??? NULL ?? ?? ? ?? ???? ?? HashTable? NULL ?? ?? ???? ??? NullPointerException? ?????. 3. ????? ??? ????? ?? ??? ?? ?? ? ????? HashTable? ? ??? ?? ?? ??? ????. ?? ConcurrenTashMap? ???? ?? ????.

Java? ?? ??? ??? ?? ??? ??? ?? ??? ??? ?? ??? ?? ?? ??? ???? ??? ?? ???? ?????. 1. ??? ???? ??? ?? ?? ? ???? ?? ??? ???? ?? ?? ??? ? ????. 2. ???? ?? ??? ???? ??? ?? ???? ?? ?? ??? ???????. 3. ?? ???? ?? ?? ?? ? ???? ???? ?? NULL ?? ??? ? ????. 4. ?? ???? ??? ?? ?? ? ??? ?????? ?? ??? ??? ?? ?? ??? ????? ??? ??? ??? ??????? ?? ???? ??????.

staticmethodsininterfaceswereIntRectionSelffacesswithinteffaceswithinteffaceswithintintinjava8toallowutilityFunctionswithinterfaceitswithinteffaceswithinterfaceffaces

JIT ????? ??? ???, ??? ?? ? ???, ?? ?? ? ???? ? ? ?? ?? ??? ? ?? ??? ?? ??? ??????. 1. ??? ???? ?? ?? ??? ??? ?? ?? ???? ??? ?? ?????. 2. ??? ?? ? ??? ?? ?? ? ??? ???? ?? ?? ???; 3. ?? ??? ??? ?? ??? ???? ???? ???? ? ?? ?? ??? ?????. 4. ?? ??? ?? ??? ??? ???? ???? ?? ? ??? ???? ?? ??? ?????.

???? ??? ??? Java?? ??? ?? ???? ??? ?? ? ? ??? ??? ???? ? ?????. ?? ???? ??? ??, ??? ?? ??? ?? ?? ??? ??? ????? ???? ????? ?????. ?? ??? ??? ??, ????? ? ??? ????, ?? ??? ??? ?????? ? ?? ? ?? ?????.

injava, thefinalkeywordpreventsavariable'svalue'svalueffrombeingchangedafterassignment, butitsbehaviordiffersforprimitivesandobjectreences.forprimitivevariables, asinfinalintmax_speed = 100; wherereassoncesanerror.forobjectref

??? ??? ?? ?? ??? ????? ? ???? ????? ???? ?? ???? ?? ???? ?????. ?? ??? ??? ????. ?? ?? ?? ??? ???? ???? ?? ?? ??? ??? ?? ?? ??? ??? ?????. ?? ??? ??? ????. ?? ??? ?? ??? ?? ?? ??? ?? ?? ??? ???? NewClass ()? ??? ?? ???? ????. ?? ??? ?? ??? ???? ?? ??? ?? ? ? ??? ?? ?? ??? ????? ????? ?????. ?? ??, ?? ?????? ?????, ??? ? ?? ????? ??? ?? ?????. ???? ?? ?? ??? ???? ?? ???? ?? ? ??? ???? ?? ??? ?? ?????? ?????. ???? ???? ??? ??, ?? ?? ? ?? ??? ????, ?? ?? ???? ?????.

??? ? ?? ??? ???? : ????? ?? ?. 1. int? ???? ???? ?? ?? ?? ? ??? ???? ?????. 2. ?? ? ???? (int) myDouble ??? ?? ?? ??? ?????. ?? ??? ??? ?? ??? ?? ??, ?? ?? ?? ???? ?? ??? ?? ???? ?? ?????. ???? ? ??? ??? ????. ?? ??? ??? ??? ??? ??? ?? ??? ??? ? ??? ?? ???? ??? ??? ??? ??? ? ??? ?? ??? ?? ??? ?? ?? ? ? ????. ?? ?? ??? ?? ??? ??? ??? ??? ? ??????.
