Are you Searching  Multiplication of two numbers program in java? You are on the right  webstite. we give you a big collection java  Programing We are provide Multiplication of two numbers program in java  and easy to understand . In the first Example  we specify the value of both the numbers in the program itself. The second Example takes both the numbers entered by user and display Multiplication  of two number.


Example 1 : Multiplication  two numbers




public class AddExample1 {

   public static void main(String args[]) {
        
      int x = 20, y = 30, M;
      M = x * y;

      System.out.println("Add two numbers is : "+M);
   }
}
Java

Output:

Multiplication two numbers is 60




Example 2 : Multiplication two numbers using Scanner

import java.util.Scanner;
class AddExample2{
    public static void main(String args[]) {

        int x, y, M;
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter two numbers:");
        x = sc.nextInt();
        y = sc.nextInt();

         M= x * y;

        System.out.println("Multiplication two numbers is:" + M);

    }
}
Java

Output:

Enter two numbers: 20
30
Multiplication two numbers is: 60