Q1. What are concepts introduced with Java 5 ?
Ans. Generics , Enums , Autoboxing , Annotations and Static Import.
Q2. Is it legal to initialize List like this ?
LinkedList<Integer> l=new LinkedList<int>();
Ans. No, Generic parameters cannot be primitives.
Q3. Which of the following syntax is correct ?
import static java.lang.System.*;
or
static import java.lang.System.*;
Ans. import static java.lang.System.*;
Q4. Which of the following syntax are correct ?
a. LinkedList<Integer> l=new LinkedList<int>();
b. List<Integer> l=new LinkedList<int>();
c. LinkedList<Integer> l=new LinkedList<Integer>();
d. List<Integer> l = new LinkedList<Integer>();
Ans. c and d are correct.
Ans. Generics , Enums , Autoboxing , Annotations and Static Import.
Q2. Is it legal to initialize List like this ?
LinkedList<Integer> l=new LinkedList<int>();
Ans. No, Generic parameters cannot be primitives.
Q3. Which of the following syntax is correct ?
import static java.lang.System.*;
or
static import java.lang.System.*;
Ans. import static java.lang.System.*;
Q4. Which of the following syntax are correct ?
a. LinkedList<Integer> l=new LinkedList<int>();
b. List<Integer> l=new LinkedList<int>();
c. LinkedList<Integer> l=new LinkedList<Integer>();
d. List<Integer> l = new LinkedList<Integer>();
Ans. c and d are correct.