Class Fraction<N extends java.lang.Number,​D extends java.lang.Number>

  • Type Parameters:
    N - The numerator type of the fraction.
    D - The denominator type of the fraction.

    public class Fraction<N extends java.lang.Number,​D extends java.lang.Number>
    extends java.lang.Object
    Represents a numerator and a denominator.
    Author:
    Garret Wilson
    • Constructor Summary

      Constructors 
      Constructor Description
      Fraction​(N numerator, D denominator)
      Constructor
    • Constructor Detail

      • Fraction

        public Fraction​(N numerator,
                        D denominator)
        Constructor
        Parameters:
        numerator - The numerator of the fraction.
        denominator - The denominator of the fraction.
    • Method Detail

      • getNumerator

        public N getNumerator()
        Returns:
        The numerator of the fraction.
      • getDenominator

        public D getDenominator()
        Returns:
        The denominator of the fraction.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation of the fraction in the form numerator/denominator.