100 Most Asked Java Interview QnA


The "static" keyword in Java is used to declare variables, methods, and nested classes



Yüklə 90,37 Kb.
Pdf görüntüsü
səhifə5/16
tarix07.01.2024
ölçüsü90,37 Kb.
#205270
1   2   3   4   5   6   7   8   9   ...   16
100 Most Asked Java Interview QnA

The "static" keyword in Java is used to declare variables, methods, and nested classes 
that belong to the class itself, rather than instances of the class. It allows accessing 
them without creating an object of the class.
30. What is the difference between "==" and ".equals()" in Java?
The "==" operator in Java is used to compare the equality of object references, while 
the ".equals()" method is used to compare the equality of object values. The ".equals()" 
method can be overridden to provide custom equality comparison.
31. What is the purpose of the "super" keyword in Java?
The "super" keyword in Java is used to refer to the superclass of a class. It can be used 
to access superclass members, invoke superclass constructors, or differentiate 
between superclass and subclass members with the same name.
32. What is a thread in Java?
A thread in Java is a lightweight unit of execution within a program. It allows 
concurrent execution of multiple tasks or activities, enabling better utilization of 
system resources.
33. How do you create and start a thread in Java?
To create and start a thread in Java, you can either extend the "Thread" class and 
override the "run()" method, or implement the "Runnable" interface and pass it to a 
new "Thread" object. Then call the "start()" method on the thread object to begin 
execution.
34. What is synchronization in Java?
Synchronization in Java is a technique used to control the access and execution of 
multiple threads to ensure that only one thread can access a shared resource or code 
block at a time.
35. What is the difference between the "synchronized" block and the "synchronized" 
method?



Yüklə 90,37 Kb.

Dostları ilə paylaş:
1   2   3   4   5   6   7   8   9   ...   16




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©www.azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin