| | |
generics in java
![]() |
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 |
911 actionlistener addressbook android api append applet application array arrays automation binary block bluetooth character chat class client code component consumer csv database desktop developmenthelp eclipse error fractal ftp game givemetehcodez graphics gui html ide image input integer j2me j2seprojects japplet java javaarraylist javac javaee javaprojects jni jpanel julia lego linked linux list loop loops mac map method methods mobile netbeans newbie number objects online oriented panel printf problem program programming project projects properties recursion replaydirector reporting researchinmotion rotatetext rsa scanner se server set sms sort sql string swing test textfields threads time title tree tutorial-sample ubuntu update windows working






