Results 1 to 2 of 2
  1. #1
    Jagdeesh123 is offline Member
    Join Date
    Nov 2010
    Posts
    9
    Rep Power
    0

    Default Letter L or l to long integer?

    wat is the use of suffixing the letter L or l to a long integer number?

    unless we suffix also it ll assign the number to long variable.

    eg: long a = 10;
    long a = 10L;

    both are results same, then wat is the use of L with the number.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,005
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Jagdeesh123 View Post
    wat is the use of suffixing the letter L or l to a long integer number?

    unless we suffix also it ll assign the number to long variable.

    eg: long a = 10;
    long a = 10L;

    both are results same, then wat is the use of L with the number.
    In case of ambiguity you can tell the compiler that your number is a long number by appending an L or l. As you have already noticed it isn't necessary in many situations. Also, when the number doesn't fit in an int you have to tell the compiler explicitly that it's dealing with a long number, e.g. 9876543210L.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. convert unsigned integer to signed integer in java?
    By diskhub in forum New To Java
    Replies: 6
    Last Post: 05-17-2010, 12:50 AM
  2. Please Review My Code (Long Integer Addition)
    By Saradus in forum New To Java
    Replies: 12
    Last Post: 07-05-2009, 01:01 PM
  3. Letter view
    By wide in forum NetBeans
    Replies: 1
    Last Post: 07-02-2009, 02:40 PM
  4. Letter with Letters
    By elgatoboricua in forum New To Java
    Replies: 7
    Last Post: 09-16-2008, 02:59 PM
  5. Calculate sum of long integer!
    By Julingo in forum New To Java
    Replies: 2
    Last Post: 09-09-2008, 11:50 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •