0
I have never come across this type of variable
example: do =20.22d; and double do=20.22d; float pi=3.14f; what is it. i mean what does the letters d and f after the numbers represents. what type of variable is it.
2 Respostas
+ 2
d stands for double and f stands for float. It is more common to use f because a number with a decimal point is always a double by default.
+ 1
first you must understand..
what is literals?
int a=10;.
10 is a integers literals.
String s="hello";
"hello" is a string literals.
float f=10.5
10.5 is a float literals..
now understand the concept..
when we give direct value.
like
10
10.5
"hello"
these all are called literals
...
In java
integer literal is treated as a" int"
floating literals is treat as a "double"
.
..
so
these word like d, f
help us and our compile..
the above value is for double or float..