Read Java Interview Questions and Answers for Beginners and Experienced

Java Multiply operator Example

In this Java examples of Java tutorial, we will study about Java multiply operator with example. We will study what is the use of Java multiply operator.

 


Java Multiply operator

Java multiply operator is used to multiply the two numbers . Java multiply operator is written as

X * Y
• Here X and Y are two numbers
• * is the java multiply operator.

 


Java Multiply operator Example

Let’s understand Java multiply operator with example.


public class JavaExamples {

public static void main(String[] args) {
//Java multiply operator with example in Java
int firstNumber=20;
int secondNumber=10;
int result=firstNumber * secondNumber;
System.out.print("result is:"+result);

}

}

output

result is:200

Explanation
In above Java multiply operator program, firstNumber and secondNumber are two integer variables. We applied Java multiply operator on these two numbers. We save the result in result variable.

In this Java operators with example, we saw how Java multiply operator works with example.