| | |
generics in java
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Yes, and that is a different story. You repeatedly said you were working with int and float, which are not the same thing.
You can use the "instanceof" operator to check the type of an object variable.
(I think you also mean "abstraction" in your original question - not generics, based on the question. Generics are a type parameterization mechanism introduced in Java 1.5)
You can use the "instanceof" operator to check the type of an object variable.
(I think you also mean "abstraction" in your original question - not generics, based on the question. Generics are a type parameterization mechanism introduced in Java 1.5)
Last edited by Ezzaral; Dec 3rd, 2007 at 2:44 pm.
If your method implementation can work with both integer and floating point numbers, why handle them differently?
If it can't, why use generics to template away the difference in the method signature?
I assume you pass in an argument of type <E extends Number> ?
If it can't, why use generics to template away the difference in the method signature?
I assume you pass in an argument of type <E extends Number> ?
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
![]() |
Similar Threads
- Another Java Noob :( (Java)
- problem with java.util.Collections (Java)
- Return values from a method by not using return (Java)
- Generics? (Java)
- My Java Dream (Java)
Other Threads in the Java Forum
- Previous Thread: Need help with a method
- Next Thread: ArrayList or Vector ?
| Thread Tools | Search this Thread |
Tag cloud for Java
-xlint 2dgraphics android api apple applet application applications arguments array arrays automation bank binary bluetooth chat class classes client code collision component database db development draw eclipse eclipsedevelopment error event exception file fractal game givemetehcodez graphics gui helpwithhomework homework html ide image input integer integration j2me jarfile java javadesktopapplications javafx javaprojects jmf jni jpanel julia learningresources linux list loop map method methods mobile netbeans newbie number object oracle print problem program programming project projectideas recursion researchinmotion scanner screen server service set size sms socket sort sorting sql sqlserver state string swing swt tcp test text-file threads time tree web windows






