How to add fractions in Java?

To add fractions in Java do this: A/B + C/D = (AxD + CxB)/(BxD).

Cross multiply numerators with denominators and divide by product of denominators:

String addFractions(int a, int b, int c, int d) {
  return (a * d + c * b) + "/" + (b * d);
}

System.out.println(addFractions(3, 7, 11, 5)); // 92/35