2

I have come across many java programs where I have found a style of programming new to me:

Class_name<...>

Can anyone plase explain what is this.?

Sharda Singh
  • 727
  • 3
  • 10
  • 19
  • 2
    It seems that you are asking about [generics](http://docs.oracle.com/javase/tutorial/java/generics/types.html) – Pshemo Apr 06 '13 at 18:14

3 Answers3

6

Generics in Java. Take a look at this http://docs.oracle.com/javase/tutorial/java/generics/

sdautovic
  • 115
  • 1
2

Angular backets are used to specify generics.

Check this post: Why is Java's Class<T> generic?

Community
  • 1
  • 1
Lokesh
  • 7,810
  • 6
  • 48
  • 78
  • This feature has been added in jdk 5 onwards and purpose is type safety to avoid class cast exception – spandey Jan 10 '18 at 06:17
1

http://docs.oracle.com/javase/tutorial/java/generics/ will help. generic type is in short saying a param of type Object will in fact be using specified class or interface instead. so you can have an array list with just strings. why - type safety (less bugs that are difficult to spot) and easier to type.

tgkprog
  • 4,493
  • 4
  • 41
  • 70