• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/11

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

11 Cards in this Set

  • Front
  • Back
What is garbage collection?
Garbage collection is a mechanism used to identify and discard objects that are no longer needed by a JVM 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.
Can you invoke garbage collection programmatically?
You can use System.gc() or you can use:

Runtime.getRuntime().gc();
What is the finalize method?
The default implementation of the finalize method does nothing except return normally without errors. This method is called just before garbage collection and is for the purpose of being overridden by the developer in order to perform clean up before garbage collection.
What is a weak reference?
A weak reference is a reference that doesn't prevent garbage collection. Caching is one application for weak references.
What are memory leaks in Java. How can one get a memory leak in a garbage collected environment?
Memory leaks occur in Java when resources that should be released are not. For example, if you have a loop that adds Objects to and removes Objects from a collection but it is faulty and neglects to remove some Objects such that the collection grows continuously, that is a memory leak.
What is a JIT complier and how is it useful?
JIT is an acronym for Just In Time. This is a system where code is compiled as needed to something lower level than byte code, speeding performance.
What is a ReferenceQueue object?
The ReferenceQueue class makes it easy to keep track of dead references. This is a queue to which registered reference objects are appended by the garbage collector after the appropriate reach-ability changes are detected.
What is a phantom reference?
A phantom reference is an object used to track when an object is about to become garbage collected. Phantom references are most often used for scheduling pre-mortem cleanup actions in a more flexible way than is possible with the Java finalization mechanism.
What is a SoftReference object?
This is an object that wraps another object in it. SoftReference may be garbage collected if the garbage collector needs memory. However compared to WeakReference, garbage collector is less aggressive in reclaiming an object referred to by a SoftReference object.
What is adaptive optimization?
A means by which portions of code are re-compiled at runtime based on the current execution profile. With a simple implementation, an adaptive optimizer may simply make a trade-off between JIT compilation and interpretation. At another level, adaptive optimization may take advantage of local data conditions to optimize away branches and to use inline expansion to decrease context switching. It's included in the default desktop JVM implementation.
What is important to know about the Java String Constants pool?
String literals are added to the pool unless they are created with the new keyword. If I create a string String myString = "string 123"; it will be pulled from the pool however if I create String myString = new String ("string 123"); it will not be pulled from the pool.