Saturday, September 16, 2017

Multiplication Operator In Java

Hi All,

Today I'm going to talk about multiplication operator in java. As we all know multiplication operator use to multiply two or more values and find the answer. Symbol of multiplication operator is * in java and most of other programming languages. In natural languages we use (X) to symbolize multiplication operator

Ex:

2 * 2 = 4

2 * 2 * 3 = 12

Let's take a look at how we can use this operator in java code.





Data type conflict while we use multiplication operator. We must make sure about the values we get after we multiplication. That value must match to data type of the variable which we use as answer. Otherwise it will make a compilation error.


If we make a's data type into double we can fix this error.


From my next post I will take about division operator in java. bye........!