Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: what are integer literals & where can they come in handy

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    17
    My Mood
    Stressed
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Question what are integer literals & where can they come in handy

    so i was reading the article about primitive data types and i came across litterals. so i understand the uses of the 8 primative types but i dont understand why you would do this below

    float pi = 3.1415F;
    long pi2 = 3141L;


    does adding the extra 'F' / 'L' onto the value do anything ? i have been struggling to find infomation that I understand. also where would i use these in a program. thanks, hope you understand what im trying to get at :S massive learninng curve, SO MUCH TO LEARN !!

    if there are any articles you could link me to that would be great, just trying to save you time on explaining.


  2. #2
    Junior Member
    Join Date
    Jun 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: what are integer literals & where can they come in handy

    Literals are constant piece of data and it tells the data type and value. Here are a few examples of literals:
    25 (int)
    25.0 (double)
    "hi!" (String)
    "42" (String)

    Notice how writing them differently is important. Here's the 1st part of a video series that gives a pretty comprehensive explanation of literals and data types: Java Tutorial 1.1 Primitives & Literals - YouTube

Similar Threads

  1. How to get SQL literals after parsing in mySQL Connector/J ?
    By amughost in forum JDBC & Databases
    Replies: 0
    Last Post: June 21st, 2012, 06:26 AM
  2. Big Integer help
    By ZekeQR in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 18th, 2012, 09:03 AM
  3. Integer program help
    By oriordc2 in forum Member Introductions
    Replies: 3
    Last Post: February 26th, 2012, 02:38 PM
  4. Using Integer.parseInt
    By Fraz in forum Object Oriented Programming
    Replies: 1
    Last Post: April 5th, 2010, 07:50 AM
  5. int and Integer
    By chronoz13 in forum Java Theory & Questions
    Replies: 5
    Last Post: December 31st, 2009, 03:20 AM

Tags for this Thread