Java ???? ??? ???? ??? ??? ??? ???? ? ??????. ?? ?? ??? ??? ??? ??? ? ?? ???, ??? ? ?????? ???? ?? ???? ???? ??? ? ????. ? ????? ??? ?? ???? ???? ??? ?? ??? ???? ???? ??? ???? ???? ?????.
? ?????? ??? ??
Java ??? ???? ????. ? ??? ??? ?? ??? ??? ??? ? ????.
String[] fruits = new String[3]; fruits[0] = "Apple"; // Correct fruits[1] = 123; // Compile-time error
??? ??? ???? ????? ???? ???? ?????. ??? ???? ??? ??(???, ??, ??)? ?? ????? ???? ???? ?? ?? ??? ?????.
Generics? ?????? ??? ??? ??? ???? ???? ?????. ??? ?? Fruit ????? ??? ?????.
1??: ?? ??? ??
?? ??? ??? ?? ???, ??, ??? ?? ?? Fruit
???? ?? ???? ?????.
// Base class for fruits public abstract class Fruit { private String name; public Fruit(String name) { this.name = name; } public String getName() { return name; } } // Specific fruit classes public class Banana extends Fruit { public Banana() { super("Banana"); } } public class Apple extends Fruit { public Apple() { super("Apple"); } } public class Grape extends Fruit { public Grape() { super("Grape"); } }
???? ??? ??? ??
Fruit
???? name
?? ?? ??? ???? ??? ?? ??? ???? ?? ?? ??????. ?? ???? ? ??? ??? ??? ?? ?????? ? ?? ? ????. ?? ???? ?? ??? ?????!
2??: ?? ???? ???
?? ?? ???? ????? ?? ?? ??? ?? ? ?? ???? ???? ShoppingCart
???? ??? ?????.
import java.util.ArrayList; public class ShoppingCart<T extends Fruit> { // Restricts to Fruit and subclasses private ArrayList<T> items = new ArrayList<>(); public void addItem(T item) { items.add(item); } public void removeItem(T item) { items.remove(item); } public void displayItems() { for (T item : items) { System.out.println(item.getName()); } } }
T extends Fruit
? Fruit
?? ? ?? ??? ??? ? ??? ?? ?? ??? ?????.
3??: ???? ??
?? ????? ShoppingCart
? ??? ????? ???????.
public class Main { public static void main(String[] args) { ShoppingCart<Fruit> fruitCart = new ShoppingCart<>(); // Adding fruits fruitCart.addItem(new Banana()); fruitCart.addItem(new Apple()); fruitCart.addItem(new Grape()); // Displaying contents System.out.println("Shopping Cart:"); fruitCart.displayItems(); // Removing an item fruitCart.removeItem(new Apple()); // Removal based on object equality (equals() can be overridden) System.out.println("\nAfter removing Apple:"); fruitCart.displayItems(); } }
???? ??
-
?? ???: ??
T
? ?? ??? ?? ??? ??? ? ????. -
???: ??? ??
Fruit
??? ???? ????? ????. - ??? ??: ?? ???? ???? ???? ?? ??? ??? ?????.
??
? Fruit
?? ??? ShoppingCart
?? Java ???? ???? ???? ?????. ???? ?? ???? ?? ???? ???? ?? ??? Java ????? ?? ?????.
? ????
- Java ?? ??
- ???? Java(Joshua Bloch)
? ?? ?????
- ????
- ???
- ?????
? ??? Java? ??? ??: ??? ?? ???? ??? ???? ??? ?? ?????. ??? ??? 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?? ??? ?? ???? ??? ?? ? ? ??? ??? ???? ? ?????. ?? ???? ??? ??, ??? ?? ??? ?? ?? ??? ??? ????? ???? ????? ?????. ?? ??? ??? ??, ????? ? ??? ????, ?? ??? ??? ?????? ? ?? ? ?? ?????.

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

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

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