HadoopExam Learning Resources

Following are the Oracle Java and Oracle SQL Products Provided by HadoopExam Learning Resources
Free Core Java 1Z0-808 Training Java 1Z0-808 Questions and Answers Java 1Z0-809 Questions and Answers Questions for Oracle 1Z0-060 : Upgrade to Oracle Database 12c Administrator Oracle Database 12c: SQL Fundamentals

Question 14: package com.hadoopexam;

Question 14: package com.hadoopexam;

class Parent {}

class FirstChild extends Parent {}

class SecondChild extends Parent {}

class Welcome {

public static void main(String[] args) {

Parent[] array = new FirstChild[3]; //n1

array[0] = new FirstChild(); //n2

array[2] = new SecondChild(); //n3

System.out.println(array.length); //n4



1. It will throws an ArrayStoreException, when program is run. 

2. It will throw compile time exception at line n1 and n2 both. 

3. It will throw compile time exception at line n3. 

4. It will run successfully and print 3 

5. It will run successfully and print 2 

Correct Answer : 1 Exp : Creating an array with child class and assigning type of array with parent is fine. Hoiwever, we have created an array of FirstChild, which has parent child relation only with the Parent class. SecondChild has no relation with FirstChild. Hence, if you are try to add an SecondChild object to FirstChild it will throw Runtime exception named as ArrayStoreException.

I have cleared my Java 1Z0-808 Certification exam with 92% using this simulator

I have cleared my Java 1Z0-809 Certification exam with 96% using this simulator


You have no rights to post comments

You are here: Home Oracle Java 1Z0-809 Question 14: package com.hadoopexam;