Solved

Consider the Following Code Snippet: ArrayList<Double> Arr = New ArrayList<Double>();

Question 5

Multiple Choice

Consider the following code snippet: ArrayList<Double> arr = new ArrayList<Double>() ;
String element = arr.get(0) ;
Is there an error in this code?


A) Yes, a run-time error will occur because a Double value cannot be cast to a String value.
B) Yes, a compile-time error will occur because you cannot assign a Double value to a String variable.
C) No run-time error or compile-time errors will occur.
D) You cannot create an arraylist of type Double.

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents