Print Long Variable

This program prints the value of a long variable.

Problem Statement

Write a Java program that declares a long variable and prints its value.

Source Code

1 public class PrintLong {
2 public static void main(String[] args) {
3 long population = 1000000000L;
4 System.out.println("Population: " + population + " - Eduinq");
5 }
6 }

Program Output

Population: 1000000000 - Eduinq

Explanation

A long variable population is declared using the L suffix to hold a large numeric value, then printed with descriptive text, showing how to declare and print long variables.

Quick Links to Explore