Which is the Best Java Web Framework ?

Java - Interview Questions and Answers on Generics

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.



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner
comments powered by Disqus




×

Try our new Java Interview Questions Search Tool.

There are more than 1000 questions with practice tests.

It's updated daily and It's Awesome.


×

Try our new Java Practice Test tool.

There are more than 200 questions and expanding quickly. It's updated daily and It's Awesome.