Answer the question
In order to leave comments, you need to log in
Why put the letter L after the number?
class temp {
public static void main(String args[]) {
long L;
double D;
L = 100123285L; //что означает буква "L" в 100123285L? Ведь результат выполнения не меняется
D = L;
System.out.println("L and D: " + L + " " + D);
}
}
Answer the question
In order to leave comments, you need to log in
Come up with a number that goes beyond int
and try to assign it to a variable long
without "L", the program will not compile.
In this example, it is not necessary, the compiler itself will be able to choose the type of the constant, and most likely there will be a maximum warning.
But there are situations when, for example, a constant is involved in calculations, again, a smart compiler most often "guesses" what the programmer wants.
Or if the constant is a function parameter that can take different types.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question