Hi This is Shameem..
I have littlebit Confusion with Generics..
1. import java.util.*;
2. class TestGen
3. {
4.public static void main(
String[] args)
5.{
6.Queue<Integer> q = new LinkedList<Integer>();
7.q.add(2342);
8.q.add(345);
9.q.add(455);
10.q.add(new String("ishmayel"));
11.q.add(new Double(324));
12.q.add(new StringBuilder("ishmayel"));
13.showAll(q);
14.}
15.public static void showAll(Queue q)
16.{
17. q.add(new Float("ishmayel"));
18. q.add(new Double(324));
19. q.add(new StringBuilder("ishmayel"));
20. while (!q.isEmpty())
21 System.out.print(q.remove()+ " ");
22.}
23. }
Why I am getting the compilation error at lines 10,11,12 but there is no compilation errors at line 17,18, 20 what is the reasion.
I think If there is any error at lines 10,11,12 that will be repeat at line 17,18,19 also but I am getting the errors at lines 10,11,12 only why..?
please any one can help me..
Thanks in advance..
Shammem.