ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Mohana Rao Sv wrote:Try to call these methods by passing parameters.
ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Mohana Rao Sv wrote:you are saying 10.2 is double but I say it's float. But how the java understands what type of parameter you are passing.
Mohana Rao Sv wrote:you are saying 10.2 is double but I say it's float.
But how the java understands what type of parameter you are passing.
Aziza Korikova wrote:
Mohana Rao Sv wrote:you are saying 10.2 is double but I say it's float. But how the java understands what type of parameter you are passing.
well alright so now i passed in 4.94065645841246544e-324 , which is definitely a double, not float. I did not get error message saying i need to put D after the number like i did for long type..
Jeff Verdegan wrote:
Aziza Korikova wrote:
Mohana Rao Sv wrote:you are saying 10.2 is double but I say it's float. But how the java understands what type of parameter you are passing.
well alright so now i passed in 4.94065645841246544e-324 , which is definitely a double, not float. I did not get error message saying i need to put D after the number like i did for long type..
If you don't put a D, it's already a double. But for integers, if you don't put an L, it's an int, so if the number is too big for an int, it's a compiler error.
Aziza Korikova wrote:
Jeff Verdegan wrote:
Aziza Korikova wrote:
Mohana Rao Sv wrote:you are saying 10.2 is double but I say it's float. But how the java understands what type of parameter you are passing.
well alright so now i passed in 4.94065645841246544e-324 , which is definitely a double, not float. I did not get error message saying i need to put D after the number like i did for long type..
If you don't put a D, it's already a double. But for integers, if you don't put an L, it's an int, so if the number is too big for an int, it's a compiler error.
Right and my point is, why this extra step of putting L? Why does the compiler not immediately recognize a longer number as a long, not int,
the way the compiler automatically recognizes a longer decimal number as a double, not float?
Aziza Korikova wrote:
Right and my point is, why this extra step of putting L? Why does the compiler not immediately recognize a longer number as a long, not int, the way the compiler automatically recognizes a longer decimal number as a double, not float? I am just asking for the reasoning behind this
Campbell Ritchie wrote:You should use the L even after small values, eg 123L, so the compiler puts them into 64 bits rather than its having to undergo a widening conversion later.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |