What is this type of initialization know as:
long i=12l; //using 'l' to denote long variable
double d=12.0d; //using 'd' to denote double variable
Is there a difference between:
long i=12l;
and
long i=12L;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
These are just declaring and initializing a variable in the same statement, and using literals to supply the initial values.
There’s no difference between the two statements in the second snippet – except for readability. It’s much easier to read “L” because it looks nothing like a “1”. (One of the Java Puzzlers is based on this – and apparently the whole book’s font was chosen to make that puzzle even harder.)