Cracking the Java Coding Interview pdfdrive com


In case of syncronized method modifier, the byte code generated is the


Download 1.48 Mb.
Pdf ko'rish
bet61/182
Sana02.05.2023
Hajmi1.48 Mb.
#1423275
1   ...   57   58   59   60   61   62   63   64   ...   182
Bog'liq
Cracking the Java Coding Interview ( PDFDrive )

2. In case of syncronized method modifier, the byte code generated is the
exact same as nonsyncronized method. The only difference is that a flag
called ACC_SYNCRONIZED property flag in method’s method_info
structure is set if the syncronized method modifier is present.
3. Also, syncronized keyword can make the code larger in size if used in the
body of the method as bytecode for monitorenter/monitorexit is generated
in addition to any exception handling.
What is the difference between a Vector and an Array. Discuss the
advantages and disadvantages
The vector container class generalizes the concept of an ordinary C array.
Like an array, a vector is an indexed data structure, with index values that
range from 0 to one less than the number of elements contained in the
structure. Also like an array, values are most commonly assigned to and
extracted from the vector using the subscript operator. However, the vector


extracted from the vector using the subscript operator. However, the vector
differs from an array in the following important
The size of the vector can change dynamically. New elements can be
inserted on to the end of a vector, or into the middle. It is important to note,
however, that while these abilities are provided, insertion into the middle of
a vector is not as efficient as insertion into the middle of a list. A vector has
more “self-knowledge” than an ordinary array. In particular, a vector can
be queried about its size, about the number of elements it can potentially
hold (which may be different from its current size), and so on.
A vector can only hold references to objects and not primitive types. Vector

Download 1.48 Mb.

Do'stlaringiz bilan baham:
1   ...   57   58   59   60   61   62   63   64   ...   182




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling