Friday, February 2, 2018

A very important fact asked in interviews.

Fact1 : In Java array is an object. It lives in Heap (a part of JVM).

Fact2 : Array is always denoted by an auto created class.

Fact3 : In Java size of array can be zero but cant be negative.

Fact4 : The class that denotes array is a subclass of Object (Object is an default
superclass of every class).

Fact5: Array is cloneable and serializable (cloneable means, we can create clone of an array. serializable means we can save object of an array inside the file, using serialization process).

Fact6 : It is a Runtime error (means Exception) if we try to access before the the first element and after the last element of an array. First element of an array is always zero, and last element of an array is always size of array minus one.

The classes those are used to denotes array are given below ==>>

class-name : used to denote
-----------------------------------------
[B    :  array of byte
[S     :  array of short
[I     :  array of int
[L     :  array of long
[C     :  array of char
[F     :  array of float
[D     :  array of double
[Z     :  array of boolean
[Lclassname : to denote array of class [for example, array of string class is denoted as
[Ljava.lang.String; class