Tagged Interface , Ability Interface , Null Interface , Empty Interface, Blank Interface as it does not contain any fields or methods.
In 1970 , Developed by the Berkeley University for C & UNIX to write network applications . Our java.net.* package internally uses sockets and it abstracts some implementation .
A jar which can be executed by it-self as an application by just clicking on that .
Self executable jar is one which can be executed directly just by clicking on that with mouse like a .exe file in C Language.
By providing main class which contains the main() method, the starting point of application in the manifest file of the jar.
Synchronization is a process of restricting concurrent access to the shared resources. As synchronization is a performance issue, we should be very much careful fo decide at which part of the code the problem may occur. At that place provide a synchronized block or simply provide a synchronized method. just use the key word synchronized before the method or block. Please note that we can synchronize only blocks or methods. we can not synchronize variables or classes. By creating locks automatically by using wait(), notify() and notifyAll() methods the Java Virtual machine taking care of inner implementation.
By Monitor thread .
Vector, ArrayList are all growable array of objects so the size is not specific but depends upon the heap area of JVM.
Vector has a default size of 0.
A vector has its default capacity which is 10 elements, here size is different from capacity, after 10 element if we enter one element the capacity of vector changes to 20 were as size is 11 only, for example if you have entered 21 elements in a vector, then if you print v.size it results 21 but v.capacity it results 30.
Vector default size - 0; default capacity 10,
ArrayList default size - 0; default capacity 10,
Hashtable - default size 0; Hashmap - 0, HashSet ? 0;
The default initial capacity : for Hashtable 11, for HashMap 11, for HashSet 16.
Consider the output for Vector :
Vector v = new Vector();
In JavaTM, an object is phantom reachable if it is neither strongly nor softly nor weakly reachable and has been finalized and there is a path from the roots to it that contains at least one phantom reference.
The Java specification says that the phantom reference is not cleared when the reference object is enqueued, but actually, there's no way in the language to tell whether that has been done or not. In some implementations, JNI weak global references are weaker than phantom references, and provide a way to access phantom reachable objects.Java spec for class PhantomReference; Reference Objects and Garbage Collection.
Ads By Google
© 2018 - JavaSpartans.com • All Rights Reserved