Long data type in java

 
The long data type represents a 64-bit two’s complement integer. The signed long has a minimum value of -263 and a maximum value of 263-1. In Java SE 8 and later, it represent an unsigned 64-bit long, which has a minimum value of 0 and a maximum value of 264-1.

Program to declare and use Java primitive long variable.

import java.util.Date;
 
/**
 * Program to declare and use Java primitive long variable.
 * @author javawithease
 */
public class DataTypeLongExample {	
  public static void main(String args[]){ 
	//Declare long type variables.
	long l1 = new Date().getTime();
 
        //Print variables value.
        System.out.println("l1 Value: " + l1);
  }
}

Output:

l1 Value: 1449573637803

Download this example.