JavaWith.NextlevelCoders
الذهاب إلى القناة على Telegram
إظهار المزيد
418
المشتركون
لا توجد بيانات24 ساعات
-27 أيام
+1230 أيام
أرشيف المشاركات
==============================
🔵 One Short knowledge 🔵
==============================
Collections
==============================
Collection is a group of objects which can be represented as a single unit. Collections are introduced to bring a unified common interface to all the objects.
Collection Framework was introduced since JDK 1.2 which is used to represent and ~manage Collections~ and it contains:
🔵 Interfaces
🟤 Classes
🟢 Algorithms
This framework also defines map interfaces and several classes in addition to Collections.
Advantages
==============================
• High performance
• Reduces developer's effort
• Unified architecture which has
• common methods for all objects.
OOPS concept Playlist
https://youtube.com/playlist?list=PLzc94bVR_krnn2ICMQIBtWDjff6F8yppV&si=JIQpIYydXGarTKEi
👨🏻💻👩🏻💻Java Datatype Quiz
What is default value of Integer ❓
A) null
B) 0
C) 1
Choose Correct Option ⬇️
👨🏻💻👩🏻💻Java Datatype Quiz
What is default value of int ❓
A) null
B) 0
C) 1
Choose Correct Option ⬇️
👨🏻💻👩🏻💻Java Datatype Quiz
What is default value of String ❓
A) null
B) blank('\u0000')
C) '0'
Choose Correct Option ⬇️
👨🏻💻👩🏻💻Java Datatype Quiz
What is default value of char ❓
A) null
B) blank('\u0000')
C) '0'
Choose Correct Option ⬇️
In This website available All Cheatsheet with code and basic to advanced course available free
Memory Consistency Errors
==============================
Memory consistency errors occur when different threads have inconsistent views of what should be the same data.
OR
(( A memory consistency error occurs when the Java Virtual Machine (JVM) does not ensure that changes made by one thread are visible to other threads in a timely manner. This can lead to unexpected behavior, as threads may see stale or inconsistent data.))
Memory consistency errors can occur due to:
==============================
🔵 Lack of synchronization: Threads accessing shared variables without proper synchronization.
🔵 Inadequate volatile declaration: Failing to declare shared variables as
volatile, which ensures changes are always visible to other threads.
🔵 Compiler optimizations: The JVM or compiler reordering operations, which can lead to inconsistent memory visibility.
To avoid memory consistency errors:
==============================
🟢 Use synchronization: synchronized blocks or methods to ensure exclusive access to shared variables.
🟢 Declare shared variables as volatile: Ensure changes are always visible to other threads.
🟢 Use atomic variables: java.util.concurrent.atomic package provides thread-safe classes for shared variables.Q. What is transient variable ❓
A transient variable is a variable that may not be serialized.
Q. What is memory leak❓
A memory leak occurs when an object is no longer referenced or needed, but still remains in memory and is not garbage collected. This can happen due to various reasons such as:
🟢 Unclosed connections or streams
🟢 Circular references
🟢 Global variables holding references to objects
🟢 Incorrect use of caching mechanisms
Q. What is Native Method ❓
A native method is a method that is implemented in a language other than Java, typically in C or C++, and is used to access platform-specific functionality.
Native methods are declared with the
native keyword and are loaded dynamically at runtime from a separate library.What can be said about the memory allocation for str and st?
Will str.hashCode() and st.hashCode() return same value ❓
