Java

Topic: Packages

Explain method toArray?

public <T> T[] toArray(T[] a)    Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array. If the collection fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this collection.    If the collection fits in the specified array with room to spare (i.e., the array has more elements than the collection), the element in the array immediately following the end of the collection is set to null. This is useful in determining the length of the collection only if the caller knows that the collection does not contain any null elements.)    If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.    This implementation checks if the array is large enough to contain the collection; if not, it allocates a new array of the correct size and type (using reflection). Then, it iterates over the collection, storing each object reference in the next consecutive element of the array, starting with element 0. If the array is larger than the collection, a null is stored in the first location after the end of the collection. 

Browse random answers:

Which package is always imported by default?
Does importing a package imports the sub packages as well? E.g. Does importing com.bob.* also import com.bob.code.*?
What is a Java package and how is it used?
Are the imports checked for validity at compile time? e.g. will the code containing an import such as java.lang.BOB compile?
How to create a package
What is Subpackage (package inside another package) ?
How to use package?
How to Use classes stored in jar file?
How the Java Compiler Finds Files?
Write Example for package?
Explain the Directory Structure  of Packages?
Explain Package java.rmi.server?
Is the API for accessing and processing data stored in a data source (usually a relational database) using the JavaTM programming language.?
Explain Package java.util?
Explain Package javax.accessibility?
Explain Package javax.imageio?
Explain Package javax.imageio.plugins.jpeg?
Explain Package javax.jws.soap?
Explain about comparator in java.util package?
Explain Package javax.naming?
Explain about Enumeration<E> in java.util package?
Explain Package javax.rmi.CORBA?
Explain about EventListener interface?
Explain Package javax.rmi.CORBA?
Explain about Formattable in java.util package?
Explain Package javax.sql.rowset?
Explain Iterator<E> in java.util package?
Explain Package javax.swing?
Explain List<E> in java.util package?
Explain Package javax.xml?
Explain ListIterator<E> in java.util.package?
Explain Package javax.xml.bind.annotation.adapters?
Explain Map<K,V> in java.util.package?
Explain Package org.omg.CosNaming.NamingContextExtPackage?
Explain Map.Entry<K,V> in java.util package?
Explain Package org.omg.Messaging?
Explain Observer in java.util package?
Explain Package org.w3c.dom.events?
Explain Queue<E> in java.util package?
Explain RandomAccess in java.util package?
Explain SortedMap<K,V> in java.util package?
What is SortedSet?
What is public abstract class AbstractCollection<E>extends Objectimplements Collection<E>?
Explain about iterator?
Explain about size in java.util packages?
Explain isEmpty method?
Explain is contains?  
Explain method toArray?
Explain method toArray?
Explain method add?
What is remove in java.util package?
Explain method containsAll?
What is addAll?
Explain method removeAll?
Explain method retainAll ?
Explain method clear
Explain method toString
Explain java.utilClass AbstractQueue<E>?
Explain public boolean add(E o)?
Explain method removepublic E remove()?
Explain method element?
Explain method clearpublic void clear()?
Explain method addAll?
Explain  java.utilClass AbstractSequentialList<E>java.lang.Object
Explain method getpublic E get(int index)?
Explain  setpublic E set(int index,             E element)?
Explain method listIteratorpublic abstract ListIterator<E> listIterator(int index)?
Explain method trimToSize?
Explain method ensureCapacity?
Explain method isEmptypublic boolean isEmpty()
Explain method  indexOfpublic int indexOf(Object elem)?
Explain method  lastIndexOfpublic int lastIndexOf(Object elem)?
Explain method removeRangeprotected void removeRange(int fromIndex,                           int toIndex)?
Explain method sortpublic static void sort(long[] a)
Explain public static void sort(Object[] a)?
Explain method binarySearchpublic static int binarySearch(long[] a,                               long key)?
Explain method equalspublic static boolean equals(long[] a,                             long[] a2)?
Explain method fillpublic static void fill(long[] a,                        long val)?
Explain method getAnnotation(Class<A> annotationClass) in java?
Explain method asListpublic static <T> List<T> asList(T... a)?
Explain method getAnnotations() in java?
Explain hashCodepublic static int hashCode(long[] a)?
Explain method getDeclaredAnnotations() in java ?
Explain method getImplementationTitle() in java  ?
Explain method getImplementationVendor() in java?
Explain  method getImplementationVersion() in java ?
Explain method deepHashCodepublic static int deepHashCode(Object[] a)
Explain method getName() in java?
Explain method deepEqualspublic static boolean deepEquals(Object[] a1,                                 Object[] a2)
Explain method getPackage(String name)  in java?
Explain method toStringpublic static String toString(long[] a)
Explain method getPackages() in java?
Explain method getSpecificationTitle() in java?
Explain method getSpecificationVendor() ?
Explain method getSpecificationVersion() in java ?
Explain method deepToStringpublic static String deepToString(Object[] a)
Explain method hashCode() in java ?
Explain method isAnnotationPresent(Class<? extends Annotation> annotationClass)  in java?
Explain method isCompatibleWith(String desired) in java?
Explain method isSealed() in java?