Print Product of Two Numbers

This program prints the product of two numbers.

Problem Statement

Write a Java program that prints the product of two numbers.

Source Code

1 public class Product {
2 public static void main(String[] args) {
3 int a = 4, b = 6;
4 System.out.println("Product = " + (a*b) + " calculated by Eduinq");
5 }
6 }

Program Output

Product = 24 calculated by Eduinq

Explanation

int a = 4, b = 6; Declares two integers. (a*b) Multiplies them. Prints the result with Eduinq branding. Conclusion: Shows multiplication using variables.

Quick Links to Explore