Vidyarthiplus (V+) - Indian Students Online Education Forum

Full Version: Java Basics Interview Q & A - Rocky
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello everybody,,,,

Here get Frequently asked Important Java Q&A for Interviews...

Sample questions:

1. What is the difference between a constructor and a method?
A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is invoked using the new operator.
A method is an ordinary member function of a class. It has its own name, a return type (which may be void), and is invoked using the dot operator.

2. What is the purpose of garbage collection in Java, and when is it used?
The purpose of garbage collection is to identify and discard objects that are no longer needed by a program so that their resources can be reclaimed and reused.
A Java object is subject to garbage collection when it becomes unreachable to the program in which it is used.

3. Describe synchronization in respect to multithreading.
With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources.
Without synchonization, it is possible for one thread to modify a shared variable while another thread is in the process of using or updating same shared variable. This usually leads to significant errors.

:Attachment: [attachment=8636]
Great info friend
Very helpful information da....
Pages: 1 2