In both Java and C#, the binary `*` operator has always been used to obtain the product of two numerical values, which are the two operands. The code below shows a class which represents a fraction with two `int` fields – `numerator` and `denominator`. I have added a constructor which takes in two `int`s to initialize these two fields:

1: class Fraction{ 2: public int numerator; 3: public int denominator; 4: 5: // constructor 6: public Fraction (int numerator, int denominator){ 7: this.numerator = numerator; 8: this.denominator = denominator; 9: } 10: }

When you want to perform a fraction multiplication, you can write a static method, called `Multiply`, which takes in two `Fractions` and which returns a resultant new ...

Start Free Trial

No credit card required