Java long variables let you store even larger numbers. The program below shows how you can display the maximum and minimum values allowed:
UBUNTU > cat prog9.java
public class prog9
{
public static void main (String args[])
{
System.out.println
("The largest long you can have is " + Long.MAX_VALUE );
System.out.println
("The smallest long you can have is " + Long.MIN_VALUE );
}
}
UBUNTU > javac prog9.java
UBUNTU > java prog9
The largest long you can have is 9223372036854775807
The smallest long you can have is -9223372036854775808
UBUNTU >
public class prog9
{
public static void main (String args[])
{
System.out.println
("The largest long you can have is " + Long.MAX_VALUE );
System.out.println
("The smallest long you can have is " + Long.MIN_VALUE );
}
}
UBUNTU > javac prog9.java
UBUNTU > java prog9
The largest long you can have is 9223372036854775807
The smallest long you can have is -9223372036854775808
UBUNTU >
If you have a Java book on Amazon, which you would like to advertise here for free, please write to me at international_dba@yahoo.co.uk.