• +91 9723535972
  • info@interviewmaterial.com

Java Interview Questions and Answers

Java Interview Questions and Answers

Question - 151 : - What is a transient variable?

Answer - 151 : - A transient variable is a variable that may not be serialized.

Question - 152 : - Which c ontainers use a border Layout as their default layout?

Answer - 152 : - The window, Frame and Dialog classes use a border layout as their default layout.

Question - 153 : - Why do threads block on I/O?

Answer - 153 : - Threads block on I/O (that is enters the waiting state) so that other threads may execute while the I/O Operation is performed.

Question - 154 : - What is the output from System.out.println("Hello"+null);?

Answer - 154 : - Hellonull

Question - 155 : - What is synchronization and why is it important?

Answer - 155 : - With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value. This often leads to significant errors.

Question - 156 : - Can a lock be acquired onĀ  a class?

Answer - 156 : - Yes, a lock can be acquired on a class. This lock is acquired on the class's Class object.

Question - 157 : - Is null a keyword?

Answer - 157 : - The null value is not a keyword.

Question - 158 : - What method is used to specify a container's layout?

Answer - 158 : - The setLayout() method is used to specify a container's layout.

Question - 159 : - Which containers use a FlowLayout as their default layout?

Answer - 159 : - The Panel and Applet classes use the FlowLayout as their default layout.

Question - 160 : - What state does a thread enter when it terminates its processing?

Answer - 160 : - When a thread terminates its processing, it enters the dead state.


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners