The following code gives a compilation error (TRUE/FALSE).ArrayList dates = new ArrayList();dates.add(new Date());dates.add(new String());Group of answer choicesFalseTrue
Question
The following code gives a compilation error (TRUE/FALSE).ArrayList dates = new ArrayList();dates.add(new Date());dates.add(new String());Group of answer choicesFalseTrue
Solution
False
Similar Questions
Which of the following statements is VALID?Group of answer choicesArrayList<? > l = new ArrayList<? extends Number >( );ArrayList<? > l = new ArrayList<?>( );ArrayList<? extends Number> l = new ArrayList<String>( );ArrayList<? super String> l = new ArrayList<Object>( );
A local variable is defined inside a Java method. True or False?Group of answer choicesTrueFalse
Java has no explicit pointer type. True or False?Group of answer choicesTrueFalse
The elements of an ArrayList<T> in Java are homogeneous.Group of answer choicesTrueFalse
Analyze the following code:public class Test { public static void main(String[] args) { boolean[][] x = new boolean[3][]; x[0] = new boolean[1]; x[1] = new boolean[2]; x[2] = new boolean[3]; System.out.println("x[2][2] is " + x[2][2]); } } Group of answer choicesThe program has a compile error because new boolean[3][] is wrong.The program has a runtime error because x[2][2] is null.The program runs and displays x[2][2] is null.The program runs and displays x[2][2] is true.The program runs and displays x[2][2] is false.
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.