ArrayStoreException

Ads

 
 

Share on Google+Share on Google+

Nagendran
ArrayStoreException
1 Answer(s)      5 years and a month ago
Posted in : Java Interview Questions

whis is the ArrayStoreException in java? or define ArrayStoreException with exp?

Ads
View Answers

March 28, 2012 at 12:48 PM


ArrayStore Exception occurs, when you assign an array which is not compatible with the data type of that array.

Example

class ArrayStoreExceptionExample 
{
    public static void main(String[] args) 
    {
        try{
        Object x[] = new String[3];
         x[0] = new Integer(0);
        }
        catch(Exception e){
            System.out.println(e);
        }
    }
}

Ads









Related Tutorials/Questions & Answers:
ArrayStoreException
ArrayStoreException  whis is the ArrayStoreException in java? or define ArrayStoreException with exp?   ArrayStore Exception occurs, when you assign an array which is not compatible with the data type of that array
Java array copy example
, destination or both are null. An ArrayStoreException can be thrown in case
Advertisements