1. Return "null" on primitive return type function? stackoverflow.comI have a function which returns an |
2. Why Conditional expression null accepted to primitive datatype. coderanch.comhere's my GUESS... when you use the ternary operator, both the possible returned 'things' have to be of the same type. if you have an int and a null, the null gets promoted to an int with a value of zero. but if you have two nulls, neither gets promoted to a valid thing that can be assigned to an int. ... |
3. return null from primitive method coderanch.comYeah, that's a bit strange. My guess is the compiler sees the object type (null) and so decides it needs to autobox. Both null and the autoboxed true are valid instances of Boolean, so the compiler decides it's OK. On mine, I do get a warning that the unboxing may cause an NPE though. |
4. value of primitive (non-string/object) types == null ? forums.oracle.comHaving background of old school languages (C/C++, Ada, & Pascal) in my college days, I read through all of the Trails Covering The Basics and some Specialized Trails at Sun's Java Tutorials site, in addition to books like Thinking in Java, Java Cookbook and some others. I understood the basics but then seeing some tutorials/guides such as the one I mentioned ... |
5. primitive null values question forums.oracle.comSo I'm having a logic problem I don't know how to solve, so I'm hoping somebody can help. The basic problem is that i have no idea how to check a primitive value in an array to see whether it is null. The theory behind this is i've declared an array with a lot of space in extra and I only ... |