| Author |
AutoBoxing&generic
|
kishor kalapa
Greenhorn
Joined: Jun 05, 2008
Posts: 24
|
|
hi all, In this code I am geting error at Line1,if I make Line1 as comment and remove Line2 comment program running sucessfully,Can any one explain the why Line1 not working, class useme<T,X,Y> { private T T1 ; private X X1; private Y Y1; useme(T a,X b,Y c) { this.T1=a; this.X1=b; this.Y1=c; } X retX () { return X1; } Y retY () { return Y1; } T retT() { return T1; } } class Test { public static void main(String[] arg) { useme<Integer, Float,Character> us=new useme<Integer, Float,Character>(11,1.2,'a'); //line1 //useme<Integer, Float,Character> us=new useme<Integer, Float,Character>(new Integer(11),new Float(12),new Character('a'));//line2 System.out.println(" "+us.retX()+us.retY()+us.retT()); } }
|
 |
Bhavik patel
Ranch Hand
Joined: Feb 20, 2007
Posts: 49
|
|
Hello Kishor, the second parameter you are pssing at line1 is 1.2 and it will be considered as double , in fact required type is short or Short, means at line1 pass 1.2f [ June 24, 2008: Message edited by: Bhavik patel ]
|
Bhavik Patel
Glassfish Consultancy service At http://www.jmatrix.in
|
 |
kishor kalapa
Greenhorn
Joined: Jun 05, 2008
Posts: 24
|
|
Hellow Bhavik Now my program is compile sucessfully,but I not getting in reply you mention "short or SHORT as required" please explain meaning behand that, Thanks for reply.
|
 |
Bhavik patel
Ranch Hand
Joined: Feb 20, 2007
Posts: 49
|
|
Hello Kishor, Sory for my mistake...read "short or Short" as "float or Float" in my previous post. Sorry again..
|
 |
kishor kalapa
Greenhorn
Joined: Jun 05, 2008
Posts: 24
|
|
|
thanks again for reply
|
 |
 |
|
|
subject: AutoBoxing&generic
|
|
|