Hi all Is there perhaps a way to get grip of the following :Float/Double MAX_MIN VALUES,POSITVE/NEGATIVE_INFINITY,NAN casting to int /float type etc, and using MATH methods on them. It is very confusing remembering all the different results, i forgot sometimes what is what. If anyone can perhaps explain the workings around it it will help, cos memorising this makes it difficult. I have done a lot of mock questions, but hey i don't feel confident with it. Thanks for any help. Corn
Hi Like doing arithmetic or casting operations for instance: int i = (int)Float/Double.MIN/MAX_VALUE float f = Float.NEGATIVE_INFINTY int i = Math.round(f) etc. Not to talk about using % / etc on them. Maybe if i understand how double and float works i will understand. I was doing a mock exam of Dan's operators and that was the type of questions which was asked. Hope this will give you more info. Thanks for the reply Corn
Honestly, I only have a vague idea of what you are talking about. I don't spend my time memorizing the Java API. If I need to use something, I look it up in the API docs. Eventually, I know some basics about several classes by using them over and over in actual programs. I honestly don't think an abstract description will be much help. You just have to use it in a program to see how it can be used In this particular instance, I can't think of any meaningful examples where to use these constants from the Float and Double classes. I think all of them are often used for error checking, especially NAN and POSITIVE/NETAGIVE_INFINITY. Here is some pseudocode that can illustrate this:
I don't think I can be any more specific than that at the moment. Perhaps you should get a book, such as Core Java, that shows some examples of how to use such members of the API classes.