Literal integer numbers can appear in Java programs in base ten, hexadecimal, and octal forms : Literal « Java Source And Data Type « SCJP

Home
SCJP
1.Java Source And Data Type
2.Operators
3.Modifiers
4.Type Casting
5.Statements
6.Object Oriented
7.Thread
8.Utility Classes
9.File
SCJP » Java Source And Data Type » Literal 
1.7.3.Literal integer numbers can appear in Java programs in base ten, hexadecimal, and octal forms
public class MainClass {
  public static void main(String[] argv) {
    int n = 42;
    long j = 4// appending L or l makes it a long
    long k = 0xFFFFFFL;
    byte b2 = 010// an octal literal
    double f2 = 1.023// double is assumed
    float d2 = 1.023F// F or f makes it a float

    System.out.println(n);
    System.out.println(j);
    System.out.println(k);
    System.out.println(b2);

    System.out.println(f2);
    System.out.println(d2);
  }
}
42
4
16777215
8
1.023
1.023
1.7.Literal
1.7.1.Literals are used to create values that are assigned to variables.
1.7.2.Literal Values for All Primitive Types
1.7.3.Literal integer numbers can appear in Java programs in base ten, hexadecimal, and octal forms
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.