what is generics in jdk1.5?

Answers were Sorted based on User's Feedback



what is generics in jdk1.5?..

Answer / rohitjadhav

Hi,

Generics is Template support added in JDK1.5 where in we can maintain templates of object with particular type and also this object is restricted to accept type other than specified one at code time.
This help reducing runtime exception and also we can create predefined well formed templates of Type.

Best Example.

http://java.sun.com/j2se/1.5.0/docs/relnotes/features.html#generics

Code written to use the generics feature should not be a lot slower or a lot more memory-intensive than non-generic code. Using ten percent more space or time than ....

Is This Answer Correct ?    2 Yes 0 No

what is generics in jdk1.5?..

Answer / tarun

Please go through this link for more knowledge
http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf

Generics is the new feture added in the JAVA5.0. It feature
is useful in some broad applications when we are writing any
database insertion logic for the same type of Object.
suppose we have to insert a list of Employee Object this
will be declared as List<Employee> or suppose we have a list
of long values then we can simply type cast it as
List<Long>, Similarly List<String>, List<Integer>. The
generics class are used by Wrapper classes or any other
classes. Most useful in ORM technologies also.

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More Core Java Interview Questions

what is the reason behind non static method cannot be referenced from a static Context?

2 Answers  


Compare Mutex and Semaphore in java.

0 Answers   Ciena,


What are constants and how to create constants in java?

0 Answers  


What is an class?

0 Answers  


Is java a digit method?

0 Answers  






What’s the difference between constructors and other methods?

0 Answers  


What is java object name?

0 Answers  


What is a prefix function.write down a code to compute prefix function.

0 Answers  


What do you mean by stack?

0 Answers   Accenture,


What is the purpose of the strictfp keyword?

0 Answers  


What is a static class in java?

0 Answers  


What is the difference between a synchronized method and a synchronized block?

0 Answers  


Categories