*Filter candidates using TestYourCandidate.com and save 80% time ( saving time for recruiters and interviewers)
*More than 50% candidates can be filtered on Candidate Screening online tests
*Inbuilt exams are available in library, created and tested by experts Try Today...
Q.Does garbage collection guarantee that a program will not run out of memory?
view answer
Q.What is synchronization and why is it important?
view answer
Q.What is daemon thread and which method is used to create the daemon thread?
view answer
Q.What are synchronized methods and synchronized statements?
view answer
Q.If I write System.exit (0); at the end of the try block, will the finally block still execute?
view answer
Q.If I write return at the end of the try block, will the finally block still execute?
view answer
Q.Is it necessary that each try block must be followed by a catch block?
view answer
Q.What is the basic difference between the 2 approaches to exception handling.
1> try catch block and
2> specifying the candidate exceptions in the throws clause?
When should you use which approach?
view answer
Q.What are the different ways to handle exceptions?
view answer
Q.What is the difference between error and an exception?
view answer
Q: What is wrapper class? Explain with example? view answer
Q.What is serialization? Explain with example? view answer
Q.What one should take care of while serializing the object?
view answer
Q. When you serialize an object, what happens to the object references included in the object?
view answer
Q.What happens to the static fields of a class during serialization?
view answer
Q. Objects are passed by value or by reference?
view answer
Q. Primitive data types are passed by reference or pass by value?
view answer
Q. What type of parameter passing does Java support?
view answer
Q.Can a top level class be private or protected?
view answer
Q.What is the default value of an object reference declared as an instance variable?
view answer
Q.What is the difference between declaring a variable and defining a variable?
view answer
Q. What are different types of inner classes?
view answer
The JVM's heap stores all objects created by an executing Java program.
Objects are created by Java's "new" operator, and memory for new objects is allocated on the heap at run time.
Garbage collection is the process of automatically freeing objects that are no longer referenced by the program.
This frees the programmer from having to keep track of when to free allocated memory,
thereby preventing many potential bugs and headaches.
The name "garbage collection" implies that objects that are no longer needed by the program are "garbage" and can be thrown away.
Other word we can say memory recycling.
When an object is no longer referenced by the program, the heap space it occupies must be recycled so that the space is available for subsequent new objects.
The garbage collector must somehow determine which objects are no longer referenced by the program and make available the heap space occupied by such unreferenced objects.
In the process of freeing unreferenced objects, the garbage collector must run any finalizers of objects being freed.