Results 1 to 3 of 3
  1. #1
    boundless is offline Member
    Join Date
    Jan 2013
    Posts
    5
    Rep Power
    0

    Question type conversion or range

    after writting this

    public class pappu {

    public static void main(String ...l)
    {
    long x = 21474836473 , y = 5;

    }
    }

    compiler says ..

    Exception in thread "main" java.lang.Error: Unresolved compilation problem:
    The literal 21474836473 of type int is out of range

    at pappu.main(pappu.java:6)

    why this type of exception prompted.
    i have assigned "21474836473" to x which in range of long..

    thanks 4 ur attention...

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: type conversion or range

    It is interprted as an int: The literal 21474836473 of type int is out of range
    Declare it as a long.
    long x = 21474836473L
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    boundless is offline Member
    Join Date
    Jan 2013
    Posts
    5
    Rep Power
    0

Similar Threads

  1. Replies: 2
    Last Post: 12-21-2012, 04:32 AM
  2. Replies: 6
    Last Post: 09-14-2012, 12:33 PM
  3. The literal of type int is out of range?
    By Zigster in forum New To Java
    Replies: 3
    Last Post: 04-24-2012, 04:33 AM
  4. Type Conversion Confusion
    By lala in forum New To Java
    Replies: 8
    Last Post: 01-07-2011, 08:59 AM
  5. Type conversion
    By hannes in forum New To Java
    Replies: 2
    Last Post: 12-18-2009, 11:29 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
  •