Long Datatype Example Java Program


Definition

Long is a keyword which designates the 64 bit signed integer primitive type.The java.lang.Long class is the nominal wrapper class when you need to store a long value but an object reference is required.

Syntax

long  = ;

Long Datatype Example Program

class LongDatatype{
	public static void main(String[] args){
		long a=-9223372036854775808;
		long b=9223372036854775807;
		System.out.println(""+a);
		System.out.println(""+b);
	}
}

Sample Output

Output is:
-9223372036854775808
9223372036854775807