Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By JosAH

Thread: Java implicit number casting

  1. #1
    440
    440 is offline Member
    Join Date
    Oct 2015
    Posts
    1
    Rep Power
    0

    Question Java implicit number casting

    If you use L as a number suffix in an arithmetic operation, does that mean that all the numbers that follow it on the same line get converted to long types as well? For example: 365L * 24 * 60 * 60 * 1000 actually means 365L * 24L * 60L * 60L * 1000L in the compiler?

    Ok, it seems the Java Language Specification says it does.
    Last edited by 440; 10-07-2015 at 01:59 PM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    26

    Default Re: Java implicit number casting

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default Re: Java implicit number casting

    I banned the critter.

    kind regards,

    Jos
    trcooke likes this.
    Build a wall around Donald Trump; I'll pay for it.

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default Re: Java implicit number casting

    User 440 (the OP) and the banned critter happen to have the same IP address; it could be a school IP address so I didn't ban the OP but he's in my book now ...

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

Similar Threads

  1. Implicit and Explicit casting
    By jmohandos304 in forum New To Java
    Replies: 9
    Last Post: 08-23-2014, 02:45 PM
  2. Replies: 1
    Last Post: 07-14-2011, 01:14 AM
  3. Java Generics and casting
    By tyrone_sequeira in forum Advanced Java
    Replies: 0
    Last Post: 02-25-2010, 09:51 AM
  4. Implicit objects
    By JavaJunkie in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 05-20-2009, 06:21 AM
  5. JSP implicit objects
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-26-2007, 10:12 AM

Posting Permissions

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