0

Possible Duplicate:
What does suffix ‘f’ mean in Android programming?

Excuse me if it was a stupid question, but I always see people writing something like 350f and 15f when initializing animations (passing as paramter) . What does f mean? Thank you

Community
  • 1
  • 1
Snake
  • 14,228
  • 27
  • 117
  • 250

1 Answers1

1

I believe it's the format of the argument, FLOAT in this case.

JHarnach
  • 3,944
  • 7
  • 43
  • 48
  • So if you pass 15 alone, what would happen? It will still accept is as a float. Ther ehas to be a usge for this f – Snake Jan 14 '13 at 21:43
  • 3
    @Snake It depends on the method. Imagine an overloaded method, someMethod(int value) and someMethod(float value). To call the second one, you must pass a float, e.g. someMethod(15f); someMethod(15); will call the first. – Simon Jan 14 '13 at 21:47
  • 4
    @Snake `float i = 1/2;` (`i` will be `0.0`) vs `float j = 1f/2;` (`j` will be `0.5`). – Matt Ball Jan 14 '13 at 21:53
  • @MattBall +1 for a much more complete answer. – JHarnach Jan 15 '13 at 16:24