JavaWith.NextlevelCoders
الذهاب إلى القناة على Telegram
إظهار المزيد
434
المشتركون
+124 ساعات
لا توجد بيانات7 أيام
لا توجد بيانات30 أيام
أرشيف المشاركات
𝗤. 𝗪𝗵𝗮𝘁 𝗮𝗿𝗲 𝘁𝗵𝗲 𝗠𝗲𝗺𝗼𝗿𝘆 𝗔𝗹𝗹𝗼𝗰𝗮𝘁𝗶𝗼𝗻𝘀 𝗮𝘃𝗮𝗶𝗹𝗮𝗯𝗹𝗲 𝗶𝗻 𝗝𝗮𝘃𝗮𝗝𝗮𝘃𝗮?
Java has five significant types of memory allocations.
· Class Memory
· Heap Memory
· Stack Memory
· Program Counter-Memory
· Native Method Stack Memory
𝟭. 𝗖𝗹𝗮𝘀𝘀 𝗠𝗲𝗺𝗼𝗿𝘆
𝐖𝐡𝐚𝐭: Stores class-related data like methods and static variables.
𝐖𝐡𝐞𝐫𝐞: In Metaspace (Java 8+) or PermGen (pre-Java 8).
𝟮. 𝗛𝗲𝗮𝗽 𝗠𝗲𝗺𝗼𝗿𝘆
𝐖𝐡𝐚𝐭: Stores objects and instance variables.
𝐖𝐡𝐞𝐫𝐞: In the heap, divided into Young Generation and Old Generation.
𝟯. 𝗦𝘁𝗮𝗰𝗸 𝗠𝗲𝗺𝗼𝗿𝘆
𝐖𝐡𝐚𝐭: Stores local variables and method call information.
𝐖𝐡𝐞𝐫𝐞: Each thread has its own stack.
𝟰. 𝗣𝗿𝗼𝗴𝗿𝗮𝗺 𝗖𝗼𝘂𝗻𝘁𝗲𝗿 (𝗣𝗖) 𝗥𝗲𝗴𝗶𝘀𝘁𝗲𝗿
𝐖𝐡𝐚𝐭: Holds the address of the current JVM instruction.
𝐖𝐡𝐞𝐫𝐞: Each thread has its own PC register.
𝟱. 𝗡𝗮𝘁𝗶𝘃𝗲 𝗠𝗲𝘁𝗵𝗼𝗱 𝗦𝘁𝗮𝗰𝗸
𝐖𝐡𝐚𝐭: Used for executing native methods via JNI (Java Native Interface).
𝐖𝐡𝐞𝐫𝐞: Each thread has its own native method stack.
👨💻 Java Quiz
Which method is used to start a thread execution in Java?
A. run()
B. start()
C. execute()
⬇️ Guess the correct option in the comments!
👨💻 SQL Quiz
Which SQL function is used to return the largest value from a set of values?
A. MAX()
B. BIGGEST()
C. HIGHEST()
⬇️ Guess the correct option in the comments!
𝐐. 𝐖𝐡𝐚𝐭 𝐢𝐬 𝐒𝐢𝐧𝐠𝐥𝐞𝐭𝐨𝐧 𝐜𝐥𝐚𝐬𝐬 𝐢𝐧 𝐉𝐚𝐯𝐚?
A Singleton class in Java is a class that allows only one instance/Object of itself to be created and provides a way to access that instance/Object globally.
(i.e only one time object created)
𝐲𝐨𝐮 𝐜𝐚𝐧 𝐜𝐫𝐞𝐚𝐭𝐞 𝐚 𝐒𝐢𝐧𝐠𝐥𝐞𝐭𝐨𝐧 𝐜𝐥𝐚𝐬𝐬 𝐛𝐲 𝐟𝐨𝐥𝐥𝐨𝐰𝐢𝐧𝐠 𝐭𝐡𝐞𝐬𝐞 𝐬𝐭𝐞𝐩𝐬:
⏺ Make the 𝐜𝐨𝐧𝐬𝐭𝐫𝐮𝐜𝐭𝐨𝐫 of the class private to prevent outside instantiation.
⏺ Create a private static instance/Object of the class within the class itself.
⏺ Provide a public static method that returns the instance of the class. If the instance is null, create a new instance; otherwise, return the existing one.
What is the difference between Java collection and Java collections?
𝗝𝗮𝘃𝗮 𝗖𝗼𝗹𝗹𝗲𝗰𝘁𝗶𝗼𝗻
==============================
𝗗𝗲𝗳𝗶𝗻𝗶𝘁𝗶𝗼𝗻: Collection is an interface.
𝗜𝗻𝘁𝗿𝗼𝗱𝘂𝗰𝘁𝗶𝗼𝗻: Introduced in Java 1.2.
𝗣𝘂𝗿𝗽𝗼𝘀𝗲: Provides the framework for representing and manipulating groups of objects (like List, Set, Queue).
Advantage (Collection): Standardizes the way groups of objects are handled.
Java Collections
Definition: Collections is a utility class.
Introduction: Introduced in Java 1.2.
Purpose: Provides static methods for sorting, searching, and modifying collections.
Advantage (Collections): Offers utility methods to simplify common tasks on collections.
What is the difference between import and static import ?
'𝗶𝗺𝗽𝗼𝗿𝘁'
==============================
𝗣𝘂𝗿𝗽𝗼𝘀𝗲 Used to bring in classes or entire packages so that you can use them without needing to specify their full path every time.
𝗘𝘅𝗮𝗺𝗽𝗹𝗲: import java.util.List; allows you to use List directly instead of writing java.util.List.
'𝘀𝘁𝗮𝘁𝗶𝗰 𝗶𝗺𝗽𝗼𝗿𝘁'
==============================
𝗣𝘂𝗿𝗽𝗼𝘀𝗲: Used to import static members (fields and methods) of a class so that you can use them without class qualification.
𝗘𝘅𝗮𝗺𝗽𝗹𝗲: import static java.lang.Math.*; allows you to use Math.PI and Math.sqrt() directly as PI and sqrt().
𝗞𝗲𝘆 𝗣𝗼𝗶𝗻𝘁𝘀
=========
𝗶𝗺𝗽𝗼𝗿𝘁: For classes and interfaces.
𝘀𝘁𝗮𝘁𝗶𝗰 𝗶𝗺𝗽𝗼𝗿𝘁: For static members (methods, fields).
𝗘𝘅𝗽𝗹𝗮𝗶𝗻 𝘄𝗶𝘁𝗵 𝗰𝗼𝗱𝗲
==============================
// 𝐖𝐢𝐭𝐡𝐨𝐮𝐭 𝐢𝐦𝐩𝐨𝐫𝐭
java.util.List<String> list = new java.util.ArrayList<>();
// 𝐖𝐢𝐭𝐡 𝐢𝐦𝐩𝐨𝐫𝐭
import java.util.List;
import java.util.ArrayList;
List<String> list = new ArrayList<>();
// 𝐖𝐢𝐭𝐡𝐨𝐮𝐭 𝐬𝐭𝐚𝐭𝐢𝐜 𝐢𝐦𝐩𝐨𝐫𝐭
double result = Math.sqrt(Math.PI);
// 𝐖𝐢𝐭𝐡 𝐬𝐭𝐚𝐭𝐢𝐜 𝐢𝐦𝐩𝐨𝐫𝐭
import static java.lang.Math.*;
double result = sqrt(PI);
𝐂𝐨𝐧𝐜𝐥𝐮𝐬𝐢𝐨𝐧
=========
Using static import can make code shorter and more readable, but overuse can lead to confusion about where the static methods and fields come from. Use it judiciously.
If you work or want to work on Google Cloud, they are offering 300 USD free for all for a limited period of time, so go ahead and grab the same asap.
Link here : https://ad.doubleclick.net/ddm/trackclk/N5295.4347315TECHGIG/B28999036.394199262;dc_trk_aid=585472451;dc_trk_cid=183313769;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;ltd=;dc_tdv=1
This is officially by Google Cloud and you can run,test and deploy on GCP free for 300 USD 🫡
If you work or want to work on Google Cloud, they are offering 300 USD free for all for a limited period of time, so go ahead and grab the same asap.
Link here : https://ad.doubleclick.net/ddm/trackclk/N5295.4347315TECHGIG/B28999036.394199262;dc_trk_aid=585472451;dc_trk_cid=183313769;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;ltd=;dc_tdv=1
This is officially by Google Cloud and you can run,test and deploy on GCP free for 300 USD 🫡
𝗧𝗼𝗱𝗮𝘆 𝗟𝗮𝘀𝘁 𝗗𝗮𝘁𝗲 𝗳𝗼𝗿 𝗔𝗺𝗮𝘇𝗼𝗻𝗲 𝗠𝗟 𝗦𝘂𝗺𝗺𝗲𝗿 𝗦𝗰𝗵𝗼𝗼𝗹 𝗦𝗼 𝗔𝗽𝗽𝗹𝘆 𝗔𝘀 𝘀𝗼𝗼𝗻 𝗮𝘀 𝗽𝗼𝘀𝘀𝗶𝗯𝗹𝗲...
https://xathon.mettl.com/event/amazonmlsummerschool?utm_source=Splashpage&utm_medium=Amazon
𝗤. 𝗪𝗵𝗮𝘁 𝗶𝘀 𝗗𝗶𝗳𝗳𝗲𝗿𝗲𝗻𝗰𝗲 𝗕𝗲𝘁𝘄𝗲𝗲𝗻 𝐄𝐧𝐮𝐦𝐞𝐫𝐚𝐭𝐢𝐨𝐧 𝗮𝗻𝗱 𝐈𝐭𝐞𝐫𝐚𝐭𝐨𝐫?
𝗘𝗻𝘂𝗺𝗲𝗿𝗮𝘁𝗶𝗼𝗻
==============================
𝗗𝗲𝗳𝗶𝗻𝗶𝘁𝗶𝗼𝗻: A legacy interface for iterating over collections.
𝗜𝗻𝘁𝗿𝗼𝗱𝘂𝗰𝗲𝗱: JDK 1.0.
𝗠𝗲𝘁𝗵𝗼𝗱𝘀: hasMoreElements(), nextElement().
𝗘𝘅𝗮𝗺𝗽𝗹𝗲:-
Vector<String> vector = new Vector<>();
Enumeration<String> enumeration = vector.elements();
while (enumeration.hasMoreElements()) {
System.out.println(enumeration.nextElement());
}
============================== 𝗜𝘁𝗲𝗿𝗮𝘁𝗼𝗿
==============================
𝗗𝗲𝗳𝗶𝗻𝗶𝘁𝗶𝗼𝗻: A modern interface for iterating over collections.
𝗜𝗻𝘁𝗿𝗼𝗱𝘂𝗰𝗲𝗱: JDK 1.2.
𝗠𝗲𝘁𝗵𝗼𝗱𝘀: hasNext(), next(), remove()
𝗘𝘅𝗮𝗺𝗽𝗹𝗲:-
ArrayList<String> arrayList = new ArrayList<>();
arrayList.add("A");
arrayList.add("B");
Iterator<String> iterator = arrayList.iterator();
while (iterator.hasNext()) {
System.out.println(iterator.next());
}
𝗖𝗼𝗺𝗺𝗲𝗻𝘁 𝗗𝗼𝘄𝗻 𝗮𝗯𝗼𝘂𝘁 𝐄𝐧𝐮𝐦 & 𝐄𝐧𝐮𝐦𝐞𝐫𝐚𝐭𝐢𝐨𝐧
𝗤. 𝗪𝗵𝗮𝘁 𝗶𝘀 𝗗𝗶𝗳𝗳𝗲𝗿𝗲𝗻𝗰𝗲 𝗕𝗲𝘁𝘄𝗲𝗲𝗻 𝐄𝐧𝐮𝐦𝐞𝐫𝐚𝐭𝐢𝐨𝐧 𝗮𝗻𝗱 𝐈𝐭𝐞𝐫𝐚𝐭𝐨𝐫?
𝗘𝗻𝘂𝗺𝗲𝗿𝗮𝘁𝗶𝗼𝗻
𝗗𝗲𝗳𝗶𝗻𝗶𝘁𝗶𝗼𝗻: A legacy interface for iterating over collections.
𝗜𝗻𝘁𝗿𝗼𝗱𝘂𝗰𝗲𝗱: JDK 1.0.
𝗠𝗲𝘁𝗵𝗼𝗱𝘀: hasMoreElements(), nextElement().
𝗘𝘅𝗮𝗺𝗽𝗹𝗲:-
Vector vector = new Vector<>();
Enumeration enumeration = vector.elements();
while (enumeration.hasMoreElements()) {
System.out.println(enumeration.nextElement());
}
𝗤. 𝗪𝗵𝗮𝘁 𝗮𝗿𝗲 𝗶𝗻𝘁𝗲𝗿𝗿𝘂𝗽𝘁?
An interrupt is a part of the hardware system that alerts the CPU when it wants to access a specific resource. This interrupt signal is received by an interrupt handler, which “tells” the processor to operate in response to the interrupt request.
𝗤. 𝗪𝗵𝗮𝘁 𝗱𝗼 𝘆𝗼𝘂 𝗸𝗻𝗼𝘄 𝗮𝗯𝗼𝘂𝘁 𝗦𝗟𝗜𝗣?
Serial Line Internet Protocol (SLIP) is a basic protocol for communication over serial ports and routers that works with TCP/IP. They allow machines that were previously configured for direct communication to communicate with one another.
A client might be linked to the Internet service provider (ISP) over a slower SLIP line, for example. When a client requires a service, he or she submits a request to the ISP. The ISP responds to the request and sends it across high-speed multiplexed lines to the Internet. The results are then sent back to the client through SLIP lines by the ISP.
The format of a SLIP frame is fairly simple, consisting of a payload and a flag that serves as an end delimiter. The flag is usually a special character with a decimal value of 192. If this flag is included in the data, it is preceded by an escape sequence, which prevents the receiver from mistaking it for the end of the frame.
𝗤. 𝗪𝗵𝗮𝘁 𝗶𝘀 𝗡𝗔𝗧?
Network Address Translation (NAT) is an acronym for Network Address Translation. It involves modifying the IP headers of packets being transported over a traffic routing device to remap one IP address space to another.
𝗤. 𝗪𝗵𝗮𝘁 𝗶𝘀 𝗘𝘁𝗵𝗲𝗿𝗻𝗲𝘁?
Ethernet is a network technology that connects devices via cables for data transmission in Local Area Networks (LANs), Metropolitan Area Networks (MANs), and Wide Area Networks (WANs). It delivers services on the OSI Model's Physical and Data Link layers. The purpose of an Ethernet network is so computers and other devices can efficiently share files, information, and data. Ethernet was first introduced in 1980.
