Set - 4

Question 1 :

What kind of security tools are available in J2SE 5.0?

Answer :

There are three tools that can be used to protect application working within the scope of security policies set at remote sites.
keytool -- used to manage keystores and certificates.
jarsigner -- used to generate and verify JAR signatures.
policytool -- used for managing policy files.
There are three tools that help obtain, list and manage Kerberos tickets.
kinit -- used to obtain Kerberos V5 tickets.
tklist -- used to list entries in credential cache and key tab.
ktab -- used to help manage entries in the key table.

Question 2 :

How to make an array copy from System?

Answer :

There is a method called arraycopy in the System class. You can do it:

System.arraycopy(sourceArray, srcOffset, destinationArray, destOffset, numOfElements2Copy);

When you use this method, the destinationArray will be filled with the elements of sourceArray at the length specified.

Question 3 :

Can we use System.arraycopy() method to copy the same array?

Answer :

Yes, you can. The source and destination arrays can be the same if you want to copy a subset of the array to another area within that array.

Question 4 :

What is shallow copy or shallow clone in array cloning?

Answer :

Cloning an array invloves creating a new array of the same size and type and copying all the old elements into the new array. But such copy is called shallow copy or shallow clone because any changes to the object would be reflected in both arrays.

Question 5 :

When is the ArrayStoreException thrown?

Answer :

When copying elements between different arrays, if the source or destination arguments are not arrays or their types are not compatible, an ArrayStoreException will be thrown.