Record Classes In Java | Records | شرح ال records في جافا | Java New Features
ฝัง
- เผยแพร่เมื่อ 25 ม.ค. 2025
- في الفيديو دا هنتكلم عن ال Record Classفي لغة جافا.
JDK 14 introduces records, which are a new kind of type declaration.
Like an Enum, a record is a restricted form of a class. It’s ideal for "plain data carriers," classes that contain data not meant to be altered and only the most fundamental methods such as constructors and accessors.
---------------------------------------------------------------------------
أساسيات لغة جافا
• مقدمة عن البرمجة بلغة ...
هل جافا بتموت
• هل لغة جافا بتموت وعلا...
---------------------------------------------------------------------------
Record features in Java
Immutable: Record classes are immutable by default, meaning their fields cannot be changed after creation.
Concise Syntax: They reduce boilerplate code by automatically generating methods like equals(), hashCode(), and toString().
Compact Constructors: Record classes have a compact constructor syntax, allowing you to initialize fields easily.
Accessor Methods: Each field in a record is automatically provided with a public accessor method.
Pattern Matching: Records can be used with pattern matching for instance checks and data extraction.
Serialization: Records can be serialized, making them suitable for data transfer and storage.
No Inheritance: Record classes cannot extend other classes, reinforcing their role as pure data carriers.
Component Method: The fields are defined as components, which can be accessed using automatically generated methods.
---------------------------------------------------------------------------
Contact Me On LinkedIn
LinkedIn Account / abdallah96
GitHub Account github.com/abd...
HackerRank Account www.hackerrank...
تسلم ايدك يا هندسة بجد بتفيد جدا♥️